ES9
zoe驿鹿
这个作者很懒,什么都没留下…
展开
-
【ES9系列】RegExp dotAll模式、命名分组捕获、后行断言
dotAll 模式 正则表达式中,(.)可以匹配任意字符,但是4个字节的 utf16 和\n \r 换行、回车终止符不能用(.)匹配 console.log(/foo.bar/.test('foo\nbar')); // false console.log(/foo.bar/.test('fooabar')); // true // 使用 dotAll模式匹配 console.log(/f...原创 2019-11-19 18:49:26 · 533 阅读 · 0 评论 -
【ES9系列】Object 的 Rest & Spread 方法
Spread /spred/ 伸展,展开 const input = { a: 1, b: 2 } const test = { d: 6 } const output = { ...input, // 把 input 对象的内容打散到output对象里 ...test, c: 3 } console.log(input, output) // {a: 1, b: 2}...原创 2019-11-19 15:45:15 · 395 阅读 · 0 评论 -
【ES9系列】Promise.finally()
Promise.prototype.finally() Promise.prototype.finally() 方法返回一个Promise,在promise执行结束时,无论结果是fulfilled或者是rejected,在执行then()和catch()后,都会执行finally指定的回调函数。这为指定执行完promise后,无论结果是fulfilled还是rejected都需要执行的代码提供了...原创 2019-11-19 15:28:33 · 633 阅读 · 0 评论 -
【ES9系列】For await of 异步操作集合遍历
ES9 异步操作集合遍历 // 异步任务 function Gen(time) { return new Promise((resolve, reject) => { setTimeout(function () { resolve(time) }, time) }) } async function test() { let arr = [Ge...原创 2019-11-19 15:19:12 · 846 阅读 · 0 评论