Search code examples
javascriptoperators

What is the difference between != and !== operators in JavaScript?


What is the difference between the !== operator and the != operator in JavaScript? Does it behave similarly to the === operator where it compares both value and type?


Solution

  • Yes, it's the same operator like ===, just for inequality:

    !== - returns true if the two operands are not identical. This operator will not convert the operands types, and only returns false if they are the same type and value. —Wikibooks