QuestenaUn entraînement qui indique quoi revoir ensuite
Question 76

The arrow function pick is written as a => a. What happens when pick(4, 9) is evaluated?

  1. It returns 9 because the last argument wins
  2. It returns an array containing 4 and 9
  3. It throws an arity error before the body runs
  4. It returns 4 and the extra argument does not block the callBonne réponse

Explication

The call is valid even though it supplies more arguments than pick has named parameters. The parameter a receives 4 and the expression returns it; JavaScript does not enforce an exact argument count for an ordinary call.

Continuer avec ce test

Commencer l’entraînement
Question 76: The arrow function pick is written as a => a. What happens… · JavaScript Fundamentals · Questena