diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/operators/await/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/operators/await/index.html | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/operators/await/index.html b/files/zh-cn/web/javascript/reference/operators/await/index.html index 0183f4d7ae..8b07b23e41 100644 --- a/files/zh-cn/web/javascript/reference/operators/await/index.html +++ b/files/zh-cn/web/javascript/reference/operators/await/index.html @@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Operators/await <h2 id="语法">语法</h2> -<pre class="syntaxbox notranslate">[返回值] = await 表达式;</pre> +<pre class="syntaxbox">[返回值] = await 表达式;</pre> <dl> <dt>表达式</dt> @@ -38,7 +38,7 @@ translation_of: Web/JavaScript/Reference/Operators/await <p>如果一个 Promise 被传递给一个 await 操作符,await 将等待 Promise 正常处理完成并返回其处理结果。</p> -<pre class="brush: js notranslate">function resolveAfter2Seconds(x) { +<pre class="brush: js">function resolveAfter2Seconds(x) { return new Promise(resolve => { setTimeout(() => { resolve(x); @@ -56,7 +56,7 @@ f1(); <p>如果该值不是一个 Promise,await 会把该值转换为已正常处理的Promise,然后等待其处理结果。</p> -<pre class="brush: js notranslate">async function f2() { +<pre class="brush: js">async function f2() { var y = await 20; console.log(y); // 20 } @@ -65,7 +65,7 @@ f2(); <p>如果 Promise 处理异常,则异常值被抛出。</p> -<pre class="brush: js notranslate">async function f3() { +<pre class="brush: js">async function f3() { try { var z = await Promise.reject(30); } catch (e) { |