這個問題在這里已經有了答案: 我可以使用鏈式比較運算子語法嗎? (6 個回答) 39 分鐘前關閉。
// These are true
console.log(window === this)
console.log(window === self)
console.log(this === self)
console.log(window === this === self) // Why is this false?
window等于this,window等于self,并且this等于self
那么,為什么window === self === this在 JavaScript 中為false
uj5u.com熱心網友回復:
因為true不等于this。
這個表達:
window === self === this
相當于:
true === this
這是錯誤的,因為this不是布林值。
uj5u.com熱心網友回復:
因為您不能在 javascript 中以這種方式鏈接相等運算子。
window === this === self實際上與:(window === this) === self首先評估括號的地方相同。換句話說,window === this === self等于true === self其計算結果為false。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/362150.html
標籤:javascript 目的 输出 平等
上一篇:使用第二個陣列計算陣列中的唯一值
