Deletions object change search object

var obj = {
                    name : "XiaoQi",
                    sex : 'female',
                    age : 18,
                    stature : 160,
                    weight : 90,
                    apple : function () {
                        console.log('I am eating apple!!!');
                        this.weight -- ;
                    },
                    hamburger : function () {
                        console.log('I am eating hamburger!!It is delicious!!!');
                        this.weight ++ ;
                    }
                }

increase:

 

obj.site = "ZheJiang";

delete:

delete this.weight;

change:

obj .name = "QiQi";

check:

1. In the console:

obj.sex;

2. On the javascript tag:

console.log(obj.sex);

 

Guess you like

Origin www.cnblogs.com/oo5lll/p/12006834.html