js 读取内存地址

案例: 

var json = {a: 1}

console.log(json)

json.a = 2

答案是 {a: 2}

原因: 因为数组、对象都是引用型类,读取都是内存中的地址

建议使用:JSON.stringify 

你可能感兴趣的:(js)