最佳答案
MDC describes the == operator as follows:
If the two operands are not of the same type, JavaScript converts the operands then applies strict comparison. If either operand is a number or a boolean, the operands are converted to numbers if possible; else if either operand is a string, the other operand is converted to a string if possible.
With this in mind, I would evaluate "true" == true as follows:
isNaN(Number("true")) // true)String(true) === "true" // true)I've ended up with the strings "true" and "true", which should evaluate to true, but JavaScript shows false.
What have I missed?