Lesson

Create a Copy of an Object in JavaScript

In this lesson, we'll go over two popular ways to create a copy of an object in JavaScript: Object.assign and using the spread operator. We'll also go over why using these are important, since JavaScript passes object values by reference. Finally, we'll go...

Duration
3 min
Access
Free
Transcript
Available

In this lesson, we'll go over two popular ways to create a copy of an object in JavaScript: Object.assign and using the spread operator. We'll also go over why using these are important, since JavaScript passes object values by reference. Finally, we'll go over nested objects, and why methods such as Lodash's cloneDeep are necessary.