false == 'false' // false
false == '' // true
false === '' // false
var x = false || 'foo' // x is 'foo'
var y = true || 'foo' // y is true
var z = y && x // z is 'foo'
Let me be a devils advocate: If you ever have a bug caused by coercion, your code sucked in the first place and it's not coercion that caused it. So use == or ===, it doesn't make a difference.
28
u/DerGernTod May 28 '19
coercion in general