Skip to content
Nate
Stephens

ALL POSTSJavaScript

All of my published content

Objects Are Not Really Nested

Objects and arrays in JavaScript do not truly contain other objects or arrays. Instead, objects and arrays contain references to other objects or arrays. When nested objects or arrays are updated, the original object or array is updated as well. To avoid unintended mutations, you should create copies of nested objects or arrays and update the copy instead of the original.