Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects

Spread - Shallow Copy

Why does spread create a 'shallow copy' of objects?

Answer options

  • Because it only copies keys, not values
  • Because nested objects still share references with the original
  • Because it copies a maximum of 3 nesting levels
  • Because it only copies primitives, ignoring objects
Show the answer

Correct answer:

  • Because nested objects still share references with the original