// 编写简洁的声明性函数
var student = {
'name' :'李神',
'age' :18,
hobby:function(value1,value2){ // 老方法
this.like = value1;
this.like2 = value2;
}
};
student.hobby('play basketball','play computerGames');
console.log(student.like,student.like2);
// 编写简洁的声明性函数
var student = {
'name' :'李神',
'age' :18,
hobby2(value1,value2){ // 新方法 把:function 删掉
this.like3 = value1;
this.like4 = value2;
}
};
student.hobby2('play basketball2','play computerGames2');
console.log(student.like3,student.like4);