Answers for "copy dict js"

0

copy dict js

var a = {'a':1}

var b = JSON.parse(JSON.stringify(a))
//a : {'a':1}
//b : {'a':1}
a['b'] = 'hello';
//a : {'a':1,'b':hello}
//b : {'a':1}
Posted by: Guest on February-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language