フリー問題

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

問題文

A developer needs a new array holding the length of every name in names, without changing names. Which call satisfies both requirements?

選択肢

  1. names.forEach(function (n) { return n.length; }), which collects every returned value into a new array once the iteration has finished.
  2. names.map(function (n) { return n.length; }), which returns a new array of the same length and leaves names untouched.
  3. names.reduce(function (n) { return n.length; }), which replaces each element with its length in place.
  4. names.filter(function (n) { return n.length; }), which returns the length of every name.

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

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