Javascript logical “!==” operator?

前端 未结 6 1938
无人共我
无人共我 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:07

    It's != without type coercion. See the MDN documentation for comparison operators.

    Also see this StackOverflow answer, which includes a quote from "JavaScript: The Good Parts" about the problems with == and !=. (null == undefined, false == "0", etc.)

    Short answer: always use === and !== unless you have a compelling reason to do otherwise. (Tools like JSLint, JSHint, ESLint, etc. will give you this same advice.)

提交回复
热议问题