How to copy JavaScript object to new variable NOT by reference? [duplicate]

I’ve found that the following works if you’re not using jQuery and only interested in cloning simple objects (see comments).

JSON.parse(JSON.stringify(json_original));

Documentation

Leave a Comment