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));
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #shallow #copy #deep #copy #javascript
ADD COMMENT
Topic
Name
1+8 =