方法1:
var obj = {name: "xiaohong"};
Object.freeze(obj);
方法2(设置对象中某一属性不被修改):
var obj = {name: "xiaohong"};
Object.defineProperty(obj,"name",{writable:false});
方法1:
var obj = {name: "xiaohong"};
Object.freeze(obj);
方法2(设置对象中某一属性不被修改):
var obj = {name: "xiaohong"};
Object.defineProperty(obj,"name",{writable:false});