QuestenaPractice that shows what to review next
Question 81

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

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

Explanation

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.

Continue with this test

Start practice
Question 81: add is written as (a, b) => a + b, and values is [2, 3].… · JavaScript Fundamentals · Questena