-5

I came to ask what is !== for at javascript I don't have any issues with it but I want to know what it does.

  • 1
    not strictly equal to. Here are the [docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness) – Charlie Bamford Jul 09 '21 at 17:48
  • 6
    Does this answer your question? [Which equals operator (== vs ===) should be used in JavaScript comparisons?](https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons) – SuperDJ Jul 09 '21 at 17:54

2 Answers2

2

Both (===) and (!==) are called the "Strict Equality Operators". They follow the "Strict Equality Comparison Algorithm" defined by ECMA 262 5.1 Section 11.9.6

In little contrast, the equality operator (==) checks whether its two operands are equal, returning a Boolean result while attempting to convert and compare operands that are of different types.

In my opinion, its easy to understand this with examples. I hope this helps -

console.log(1 === 1);
// expected output: true

console.log('1' == 1);
// expected output: true

console.log('1' ===  1);
// expected output: false

console.log(0 === false);
// expected output: false

console.log(0 == false);
// expected output: true

Edit -

Just to answer your specific part of the question, the strict inequality operator (!==) checks the condition where the two operands being compared are not equal in either value or type.

Hari Reddy
  • 339
  • 3
  • 15
0

=== compares two values, including the type. For example:

"3" === "3" //true
"3" === 3 //false

!== is a denial of that. It means that value and type isn't the same.

"3"!==3 //true
MonR
  • 9
  • 1