ES8-2017

1. 字符串 padStart() padEnd()

'x'.padStart(5, 'ab') // 'ababx'
'x'.padStart(4, 'ab') // 'abax'

'x'.padEnd(5, 'ab') // 'xabab'
'x'.padEnd(4, 'ab') // 'xaba'

2. Object.values()/Object.entries()

let obj = { foo: 'bar', baz: 42 }
Object.values(obj) // ['bar', 42]

Object.entries(obj) // [ ['foo', 'bar'], ['baz', 42] ]

3. 函数参数列表结尾允许逗号

/*
function clownsEverywhere(
  param1,
  param2,
) {
  // ...
}
*/

4. async 函数

async function foo() {
  return 123
}

foo().then((res) => {
  console.log(res) // 123
})

5. await

async function foo() {
  let a = await 10
  let b = await 20
  return a + b
}

foo().then((res) => {
  console.log(res) // 30
})