ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] **箭头函数** ~~~ var sum = (a, b) => a+b; sum(1, 2) 3 ~~~ **对象里函数优化** 对象是这个 ~~~ const p = { name: "jack", age: 21, sayHello: function() { console.log("hello"); } } ~~~ 可以简写成 ~~~ const a = { name: "jack", age: 21, sayHello() { console.log("hello"); } } a.sayHello() VM455:5 hello ~~~ **方法里参数对象优化** ~~~ const hello = function(person) { console.log(person.name, person.age); } ~~~ 可以改成 ~~~ const hello = ( {name, age} ) => console.log(name, age); ~~~