JavaScript · Junior · Question 21 of 75

What does const copy = { ...original } do?

Explanation

Spread copies only own first-level properties. If original.address is an object, it's shared by both copies. structuredClone gives a deep copy, but it doesn't copy functions or DOM nodes.

Further reading

Problem with a question

JavaScript · Junior · question 21

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz