1
if (customer === "new") {
  //run code
} else {
}

When I run this condition it run my code while actually I have string value in customer "customername" and comparing with sring "new" which is not equal as ("customername" != "new") it should not run the code while comparing. I found to using === equal will check type if type is same it will pass true so == is the option to check the value but I am facing erro on using ==.

Expected '===' and instead saw '=='  eqeqeq
Shahid Manzoor Bhat
  • 1,301
  • 1
  • 13
  • 30
Developer
  • 617
  • 1
  • 6
  • 17

1 Answers1

4

I think you are using JSHint, the "eqeqeq" is an option to ensure the use of strict equality operators.

From here:

The JSHint eqeqeq option is used to prohibit the use of the equals operator == and the does-not-equal operator !=. This enforces the use of the strict equality operators (=== and !== instead). The strict equality operators differ from their non-strict counterparts by first comparing the type of each operand, rather than attempting to coerce them to a common type. In the following example we make use of the non-strict equality operator to check whether a value is either null or undefined

Andrea
  • 5,893
  • 1
  • 29
  • 53