← Quiz: Functions, Arrays and Objects: all 10 questions
Quiz: Functions, Arrays and Objects · Question 4 of 10
What does const { a, ...others } = { a: 1, b: 2, c: 3 } put in others?
What does const { a, ...others } = { a: 1, b: 2, c: 3 } put in others?
- A.[2, 3]
- B.{ b: 2, c: 3 }
- C.2
- D.undefined
Answer & explanation
Correct answer: { b: 2, c: 3 }
The rest pattern collects the remaining properties into a new object.
Can you get the rest right without peeking?
Take the timed Quiz: Functions, Arrays and Objects quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →