shallow copy vs deep copy
A shallow copy can be made by simply copying the reference.
A deep copy means actually creating a new array and copying over the values.
A shallow copy can be made by simply copying the reference.
A deep copy means actually creating a new array and copying over the values.
// way to deep copy
var newObject = jQuery.extend(true, {}, oldObject);
var newObject = JSON.parse(JSON.stringify(oldObject));
댓글
댓글 쓰기