Hi Kevin Dalman, thanks for reading my article and responding to it! I agree that the article could include more educational material.
I updated this article to add 3 more methods of deep copy: a custom function, JSON.parse
/JSON.stringify
, and the rfdc
(Really Fast Deep Clone) library.
Take a look and let me know what you think! Thanks again!!!
Personally, I love “Magic Libraries” because 1) They tend to work, 2) They can be swapped out or replaced with custom solutions later, and 3) You can look at the source code to learn how they work.
That’s why I end up recommending rfdc
over a custom function, though I added an example of a deep copy function that will work in most cases.