| Shallow Copy | Deep Copy |
|---|---|
| Original and shallow copy both point to the same memory location | Original and deep copy point to different memory locations |
Use ... spread operator: let shallowCopy = {...original} |
Use JSON: let deepCopy = JSON.parse(JSON.stringify(original)) |
Use Object.assign(): let shallowCopy = Object.assign({}, original) |
ayohana/exercism-js
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|