Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript copy an object without reference

var obj = {a: 25, b: 50, c: 75};
var A = Object.create(obj);
var B = Object.create(obj);

A.a = 30;
B.a = 40;

alert(obj.a + " " + A.a + " " + B.a); // 25 30 40
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #copy #object #reference
ADD COMMENT
Topic
Name
8+1 =