問題文
A form field returns the string '0'. A developer needs a comparison that treats that string as different from the number 0. Which comparison meets the requirement?
選択肢
- '0' === 0, which evaluates to false because strict equality compares types before values.
- Boolean('0') === Boolean(0), which evaluates to false and keeps the two inputs distinct from each other.
- '0' == 0, which evaluates to false because the abstract equality algorithm refuses to compare a string with a number and falls back to comparing the underlying references instead.
- '0' != 0, which evaluates to true because the loose inequality operator keeps the operand types apart and reports the two operands as different values.