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

A forEach callback returns x * 2 for every element. What does the forEach call itself return?

  1. a new array of doubled values
  2. the original array
  3. the final callback result
  4. undefinedՃիշտ պատասխան

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

forEach invokes the callback but does not collect its returned values, so the method call returns undefined. Expecting a doubled array confuses forEach with map, which is designed to gather callback results.

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

Սկսել վարժանքը
Հարց 58: A forEach callback returns x * 2 for every element. What… · JavaScript Fundamentals · Questena