typeof of boolean expression with comparison operator

て烟熏妆下的殇ゞ 提交于 2019-12-01 18:47:28

Because precedence rules for the typeof and inquality operators define that that expression is parsed as

(typeof foo) !== 'undefined'

For more information, see the MDN page on operator precedence. typeof is precedence 16; inquality is precedence 10. The higher precedence of typeof means that it "binds" more tightly to its operand.

By the way, why do you have undefined variables in your code?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!