Javascript logical “!==” operator?

前端 未结 6 1937
无人共我
无人共我 2021-02-01 12:37

I am getting back into web development, and have been trying to go over the nuances of jscript recently. I was pouring through the source of the THREEx extension library built o

6条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 13:06

    You can find === and !== operators in several other dynamically-typed languages as well. It always means that the two values are not only compared by their "implied" value (i.e. either or both values might get converted to make them comparable), but also by their original type.

    That basically means that if 0 == "0" returns true, 0 === "0" will return false because you are comparing a number and a string. Similarly, while 0 != "0" returns false, 0 !== "0" returns true.

提交回复
热议问题