copy dictionary in javascript code example
Example: 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}
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}