Questenaتدريب يوضح لك ما ينبغي مراجعته لاحقًا
السؤال 81

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

  1. 5الإجابة الصحيحة
  2. The array [2, 3]
  3. The values are gathered into a rest parameter instead
  4. A TypeError because arrays cannot supply arguments

الشرح

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.

تابع هذا الاختبار

بدء التدريب
السؤال 81: add is written as (a, b) => a + b, and values is [2, 3].… · JavaScript Fundamentals · Questena