return
as well as the brackets surrounding the code. This helps simplify smaller functions into one-line statements:
```js
const myFunc = () => "value";
```
This code will still return value
by default.
magic
which returns a new Date()
to use arrow function syntax. Also, make sure nothing is defined using the keyword var
.
var
keyword.
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: magic
should be a constant variable (by using const
).
testString: getUserInput => assert(getUserInput('index').match(/const\s+magic/g));
- text: magic
should be a function
.
testString: assert(typeof magic === 'function');
- text: magic()
should return correct date.
testString: assert(magic().setHours(0,0,0,0) === new Date().setHours(0,0,0,0));
- text: function
keyword should not be used.
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
```