0

I'm new to Java Script What is the exact difference between (== Vs ===, != Vs !==, etc) in JavaScript? Have read some articles and wanted to be more clear on this. Thanks in advance.

Zini
  • 909
  • 7
  • 15
Dextere
  • 281
  • 1
  • 3
  • 13
  • https://www.youtube.com/watch?v=O24XMM1PTqQ – Lauri Elias Apr 14 '14 at 21:14
  • if a function returns multiple values that are equivalent to false like 0, '0' or false (for example 0 means no result and false and error) and you want them to be treated the same then you can use == but if you want them to be treated differently then you have to use ===. – My1 Nov 13 '15 at 10:39

1 Answers1

3

The == operator means equality after type conversion

1 == '1';  // true
1 == 1;    // true

The === operator means equality without any conversion

1 === '1'; // false
1 === 1;   // true
Paul S.
  • 64,864
  • 9
  • 122
  • 138
Timigen
  • 1,055
  • 1
  • 17
  • 33