return关键字和外面的大括号。这样就可以将一个简单的函数简化成一个单行语句。
```js
const myFunc = () => "value";
```
这段代码仍然会返回value。
magic函数,使其返回一个新的Date()。同时不要用var关键字来定义任何变量。
var关键字。
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: magic应该为一个常量 (使用const)。
testString: getUserInput => assert(getUserInput('index').match(/const\s+magic/g));
- text: magic是一个function。
testString: assert(typeof magic === 'function');
- text: magic()返回正确的日期。
testString: assert(magic().setHours(0,0,0,0) === new Date().setHours(0,0,0,0));
- text: 不要使用function关键字。
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
```