Close button

Are You Looking for Developers to Hire?
Have a Look at Our Bench Strength

Hire Developers
Close button
JavaScript not equal and Comparison Operators Explained

JavaScript not equal and Comparison Operators Explained

By Arun Kumar

JavaScript not equal and Comparison Operators Explained

In JavaScript, != is the not equal operator, which returns true if the operands are not equal, and false otherwise.

There are several other comparison operators in JavaScript, including:

  • ==: equal to (loose equality)
  • ===: equal value and equal type (strict equality)
  • >: greater than
  • <: less than
  • >=: greater than or equal to
  • <=: less than or equal to.

When using ==, JavaScript will perform type coercion if the operands are of different types (e.g. "5" == 5 returns true). On the other hand, when using ===, no type coercion is performed and the comparison will only return true if both operands have the same value and type (e.g. "5" === 5 returns false).

JavaScript not equal and Comparison Operators Explained

JavaScript not equal and Comparison Operators Explained

JavaScript not equal and Comparison Operators Explained

JavaScript not equal and Comparison Operators Explained