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

What does pop return when called on an empty array?

  1. undefinedՃիշտ պատասխան
  2. null
  3. an empty array
  4. RangeError

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

There is no last element to remove, so pop returns undefined and leaves the array empty. Throwing a range error would be a plausible bounds policy, but it is not how this array method is specified.

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

Սկսել վարժանքը
Հարց 42: What does pop return when called on an empty array? · JavaScript Fundamentals · Questena