QuestenaÜben und erkennen, was als Nächstes dran ist
Frage 81

add is written as (a, b) => a + b, and values is [2, 3]. What does add(...values) return?

  1. 5Richtige Antwort
  2. The array [2, 3]
  3. The values are gathered into a rest parameter instead
  4. A TypeError because arrays cannot supply arguments

Erklärung

Call spread takes the iterable values 2 and 3 and supplies them as separate arguments, so add computes 5. It expands values at a call site; it is not a rest parameter that gathers incoming arguments in a declaration.

Mit diesem Test weitermachen

Übung starten
Frage 81: add is written as (a, b) => a + b, and values is [2, 3].… · JavaScript Fundamentals · Questena