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

Starting from an empty array, values are assigned only at indexes 0 and 4, and no other length-changing operation occurs. What is its length?

  1. 2
  2. 5Ճիշտ պատասխան
  3. 4
  4. undefined

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

The highest present index is 4, so length becomes one greater, which is 5. Counting only the two present elements ignores the holes and confuses array length with the number of populated positions.

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

Սկսել վարժանքը
Հարց 38: Starting from an empty array, values are assigned only at… · JavaScript Fundamentals · Questena