QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 46

Which test reliably distinguishes an array value from an ordinary non-array object?

  1. value === Array
  2. typeof value === "array"
  3. value.length is defined
  4. Array.isArray(value)Ճիշտ պատասխան

Բացատրություն

Array.isArray returns true for arrays and false for ordinary objects that are not arrays. typeof cannot make this distinction because both values produce object in that operator's classification.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 46: Which test reliably distinguishes an array value from an… · JavaScript Fundamentals · Questena