简化对象和函数写法
简化对象写法:
传统写法:
var x = 10, y = 20;
var obj = {x: x, y: y};
简化写法:
var x = 10, y = 20;
var obj = {x, y};
简化函数写法:
传统写法:
function add(x, y) {
return x + y;
}
简化写法:
var add = (x, y) => x + y;
简化对象写法:
传统写法:
var x = 10, y = 20;
var obj = {x: x, y: y};
简化写法:
var x = 10, y = 20;
var obj = {x, y};
简化函数写法:
传统写法:
function add(x, y) {
return x + y;
}
简化写法:
var add = (x, y) => x + y;