- 对象方法简写:
es5写法:
var obj = {
name: 'jeff',
getName: function () {
return this.name;
}
}
es6写法(方法定义里,少写了冒号和function):
var obj = {
name: 'jeff',
getName () {
return this.name;
}
}
var obj = {
name: 'jeff',
getName: function () {
return this.name;
}
}
es6写法(方法定义里,少写了冒号和function):
var obj = {
name: 'jeff',
getName () {
return this.name;
}
}