Deep Copying objects using JSON stringify and parse

Serialize and De-serialize

ref – https://dev.to/nas5w/js-fundamentals-object-assignment-vs-primitive-assignment-5h64

One method that can be used to deep copy an object is to serialize and de-serialize the object. One common way to do this is using JSON.stringify and JSON.parse.

However, it does not work on function objects:

ref – https://stackoverflow.com/questions/18089033/json-stringify-does-not-process-object-methods