ES6里对象新增的方法

对象的简洁语法 ES6里允许当对象属性名和值都一样时可简写成一个,也允许将函数简写,注意此时不要用箭头函数,看下例: var person = { name:‘张三’, birth: birth, //可以简写成 birth hello: function( ){ return this.name } // 可简写为 hello( ){ return this.name } } console.l
相关文章
相关标签/搜索