From d6fd4ae708fea1bd09762b22c2ffe6b08404a1f5 Mon Sep 17 00:00:00 2001 From: ZouXin <405495715@qq.com> Date: Thu, 30 Aug 2018 16:03:36 +0800 Subject: [PATCH] optimize await usage --- JS/JS-br.md | 4 +++- JS/JS-ch.md | 4 +++- JS/JS-en.md | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/JS/JS-br.md b/JS/JS-br.md index a047a7bc..42eb6a1f 100644 --- a/JS/JS-br.md +++ b/JS/JS-br.md @@ -630,7 +630,9 @@ var obj = {a: 1, b: { }} // pay attention that this method is asynchronous // it can handle `undefined` and circular reference object -const clone = await structuralClone(obj); +(async () => { + const clone = await structuralClone(obj) +})() ``` # Modularization diff --git a/JS/JS-ch.md b/JS/JS-ch.md index 3020e8ab..21b8b156 100644 --- a/JS/JS-ch.md +++ b/JS/JS-ch.md @@ -671,7 +671,9 @@ var obj = {a: 1, b: { }} // 注意该方法是异步的 // 可以处理 undefined 和循环引用对象 -const clone = await structuralClone(obj); +(async () => { + const clone = await structuralClone(obj) +})() ``` # 模块化 diff --git a/JS/JS-en.md b/JS/JS-en.md index 9df648ea..4b1b2a03 100644 --- a/JS/JS-en.md +++ b/JS/JS-en.md @@ -630,7 +630,9 @@ var obj = {a: 1, b: { }} // pay attention that this method is asynchronous // it can handle `undefined` and circular reference object -const clone = await structuralClone(obj); +(async () => { + const clone = await structuralClone(obj) +})() ``` # Modularization