QuestenaUn entraînement qui indique quoi revoir ensuite
Question 59

After result = [1].concat([2]), which statement is correct?

  1. result is [1, 2], and both inputs are unchangedBonne réponse
  2. the first input becomes [1, 2]
  3. result is the number 2
  4. the second input becomes empty

Explication

concat returns a new shallow array containing values from both inputs, so result contains 1 and 2 while the input arrays remain unchanged. Claiming that the first input grows confuses combination with a mutating append operation.

Continuer avec ce test

Commencer l’entraînement
Question 59: After result = [1].concat([2]), which statement is correct? · JavaScript Fundamentals · Questena