I read this in Eloquent JavaScript book:
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.
Because of this, expressions like 0 == false and "" == false are true.
And also following these rules this expression should evaluate to true:
console.log("A" == true)
But it evaluates to false. Why?
"A"to boolean; you're comparing a string and a boolean, which is a different thing and it's definitively not solved by casting the left operand to the type of the right operand. If you check the accepted answer in the linked question, I reckon that rule #10 applies.x == ToNumber(y)>"A" == 1, which isfalse, of course.