JavaScript is a high-level, dynamically typed client-side scripting language.
Shallow Copy : In JavaScript, a shallow copy refers to creating a ...
For further actions, you may consider blocking this person and/or reporting abuse
A deep copy is better achieved using
structuredClone- it is slower, but way more powerful.Thank you @jonrandy for sharing your perspective!
stringifyandparsewill play havoc if your object has references to the same objects within it - the copy will have all of the data, but they'll all be different objects afterwards.Not only that, it'll throw errors if you have circular references in the object you want to clone
Very good point :)
Hey @miketalbot , You are correct that using JSON.stringify and JSON.parse for deep copying objects can lead to issues when there are references to the same objects within the object structure.
Hi Jenish Dabhi,
Your tips are very useful
Thanks for sharing
Awesome 💯 keep it up