FrontendInterviews.dev

645. Object.assign Shallow Copy

Easy•

Predict the output.

const src = { nested: { v: 1 } }
const copy = Object.assign({}, src)
copy.nested.v = 7
console.log(src.nested.v)

What is printed in the console?

Select an option and submit your answer.
Next Problem