Closed rangitha closed 6 years ago
From the 3rd edition:
The rules for converting strings and numbers to Boolean values state that 0, NaN, and the empty string ("") count as false, while all the other values count as true.
However, in DevTools of Chrome 65:
false == false // true false == 0 // true false == "" // true false == NaN // false
I can't remember what the result of the last expression was when I read the 2nd edition. But it doesn't look like it's applicable anymore.
This is about converting to boolean, not comparing with a boolean value. That's a different set of rules, which is mentioned elsewhere in the chapter.
From the 3rd edition:
However, in DevTools of Chrome 65:
I can't remember what the result of the last expression was when I read the 2nd edition. But it doesn't look like it's applicable anymore.