2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Write Concise Declarative Functions with ES6
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Write Concise Declarative Functions with ES6
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
---
|
|
|
|
## Problem Explanation
|
2018-10-12 15:37:13 -04:00
|
|
|
ES6 makes it easy, and fancy, to write declarative functions! In this lesson, you are tasked at changing the function to follow ES6 standards.
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
Get rid of the `function` keyword.
|
|
|
|
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
---
|
|
|
|
## Solutions
|
|
|
|
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
const bicycle = {
|
|
|
|
gear: 2,
|
|
|
|
setGear(newGear) {
|
|
|
|
"use strict";
|
|
|
|
this.gear = newGear;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
```
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
</details>
|