🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.[2, 3]
  2. B.{ b: 2, c: 3 }
  3. C.2
  4. 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 →