Fixing minor misstypes
Patching some small mistakes and suggesting some improvements.
This commit is contained in:
parent
0c9f223716
commit
98da5e0903
10
es6.md
10
es6.md
|
@ -166,7 +166,7 @@ Promise.resolve(···)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
async function run () {
|
async function run () {
|
||||||
const user = await getUsers()
|
const user = await getUser()
|
||||||
const tweets = await getTweets(user)
|
const tweets = await getTweets(user)
|
||||||
return [user, tweets]
|
return [user, tweets]
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ var [math = 50, sci = 50, arts = 50] = scores
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Result:
|
// Result:
|
||||||
// math === 22, sci === 23, arts === 50
|
// math === 22, sci === 33, arts === 50
|
||||||
```
|
```
|
||||||
|
|
||||||
Default values can be assigned while destructuring arrays or objects.
|
Default values can be assigned while destructuring arrays or objects.
|
||||||
|
@ -303,7 +303,7 @@ const users = [
|
||||||
```js
|
```js
|
||||||
const users = admins
|
const users = admins
|
||||||
.concat(editors)
|
.concat(editors)
|
||||||
.concat([ '@rstacruz' ])
|
.concat([ 'rstacruz' ])
|
||||||
```
|
```
|
||||||
|
|
||||||
The spread operator lets you build new arrays in the same way.
|
The spread operator lets you build new arrays in the same way.
|
||||||
|
@ -318,7 +318,7 @@ Functions
|
||||||
#### Default arguments
|
#### Default arguments
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function greet (name = "Jerry") {
|
function greet (name = 'Jerry') {
|
||||||
return `Hello ${name}`
|
return `Hello ${name}`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -423,7 +423,7 @@ See: [Object literal enhancements](http://babeljs.io/learn-es2015/#ecmascript-20
|
||||||
```js
|
```js
|
||||||
let event = 'click'
|
let event = 'click'
|
||||||
let handlers = {
|
let handlers = {
|
||||||
['on' + event]: true
|
[`on${event}`]: true
|
||||||
}
|
}
|
||||||
// Same as: handlers = { 'onclick': true }
|
// Same as: handlers = { 'onclick': true }
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue