Fixing minor misstypes

Patching some small mistakes and suggesting some improvements.
This commit is contained in:
Mihailo Misic 2017-10-31 11:32:58 +01:00 committed by GitHub
parent 0c9f223716
commit 98da5e0903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

10
es6.md
View File

@ -166,7 +166,7 @@ Promise.resolve(···)
```js
async function run () {
const user = await getUsers()
const user = await getUser()
const tweets = await getTweets(user)
return [user, tweets]
}
@ -212,7 +212,7 @@ var [math = 50, sci = 50, arts = 50] = scores
```js
// Result:
// math === 22, sci === 23, arts === 50
// math === 22, sci === 33, arts === 50
```
Default values can be assigned while destructuring arrays or objects.
@ -303,7 +303,7 @@ const users = [
```js
const users = admins
.concat(editors)
.concat([ '@rstacruz' ])
.concat([ 'rstacruz' ])
```
The spread operator lets you build new arrays in the same way.
@ -318,7 +318,7 @@ Functions
#### Default arguments
```js
function greet (name = "Jerry") {
function greet (name = 'Jerry') {
return `Hello ${name}`
}
```
@ -423,7 +423,7 @@ See: [Object literal enhancements](http://babeljs.io/learn-es2015/#ecmascript-20
```js
let event = 'click'
let handlers = {
['on' + event]: true
[`on${event}`]: true
}
// Same as: handlers = { 'onclick': true }
```