Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

shallow copy and deep copy in javascript

// shallow copy :: modification in original array
 var newEmployee = employee;

// Deep copy :: no modification in orifinal array
 var newEmployee = JSON.parse(JSON.stringify(employee));
 
PREVIOUS NEXT
Tagged: #shallow #copy #deep #copy #javascript
ADD COMMENT
Topic
Name
4+8 =