ProUnebit
12/17/2018 - 6:38 PM

Deep copy obj

// Shallow copy (jQuery)
var newObject = jQuery.extend({}, oldObject);

// Deep copy (jQuery)
var newObject = jQuery.extend(true, {}, oldObject);

// Vanilla
var newObject = JSON.parse(JSON.stringify(oldObject));