フリー問題

Salesforce Certified JavaScript Developer のフリー問題 1 / 20 問目

問題文

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?

選択肢

  1. '0' === 0, which evaluates to false because strict equality compares types before values.
  2. Boolean('0') === Boolean(0), which evaluates to false and keeps the two inputs distinct from each other.
  3. '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.
  4. '0' != 0, which evaluates to true because the loose inequality operator keeps the operand types apart and reports the two operands as different values.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。