1

Example:

'0'== false
true

But if I try using '0' on a if statement, it evals true:

if('0') console.log(true)
true
Facundo Petre
  • 281
  • 2
  • 5
  • 1
    Check out [this](https://stackoverflow.com/questions/27523765/how-does-js-type-coercion-work) and [this](https://stackoverflow.com/questions/523643/difference-between-and-in-javascript/523650#523650) answer for some explanation of javascript coercion. – Jeremy Oct 12 '18 at 16:12
  • 3
    because == coerces it to false and '0' is a non-empty string, e.g truthy – mplungjan Oct 12 '18 at 16:12
  • 1
    mplungian, i think you mean 'ie', not 'eg' ("in other words" vs "for example") – Scott Weaver Oct 12 '18 at 16:15
  • Always mix them. Thanks – mplungjan Oct 12 '18 at 19:54

0 Answers0