Answers for "js how to assign object and update without reference"

3

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
Posted by: Guest on July-27-2020
4

clone javascript object

let clone = Object.assign({}, objToClone);
Posted by: Guest on February-19-2020

Code answers related to "js how to assign object and update without reference"

Code answers related to "Javascript"

Browse Popular Code Answers by Language