/*函数的优化*/ //以前 function sum(a,b) { return a+b; } //优化 const add = (a,b)=>a+b; //以前 const p1 = { name:"mike", age:21, sayHello:function(){ console.log("hello"); } } //优化 const p2 = { name:"mike", age:21, sayHello(){ console.log("hello"); } } //以前 const hello = function(person){ console.log(person.name,person.age); } //优化 const hello2 = function({name,age}){ console.log(name,age); } //再度优化 const hello3 = ({name,age})=>{ console.log(name,age); }
ECMAScript5/6新特性之函数的优化
猜你喜欢
转载自blog.csdn.net/shijiaolong0/article/details/85322946
今日推荐
周排行