diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/generator')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/generator/index.html | 6 | ||||
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/generator/throw/index.html | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/generator/index.html b/files/zh-cn/web/javascript/reference/global_objects/generator/index.html index 612024ca88..f7e4fc037b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/generator/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/generator/index.html @@ -65,13 +65,13 @@ console.log(gen.next().value); <dl> <dt><code>Generator.prototype.next() </code>{{non-standard_inline}}</dt> - <dd>返回 {{jsxref("Operators/yield", "yield")}} 表达式产生的值. 与ES2015 生成器对象的<span style="font-family: courier,andale mono,monospace;">next()方法对应</span>.</dd> + <dd>返回 {{jsxref("Operators/yield", "yield")}} 表达式产生的值. 与ES2015 生成器对象的next()方法对应.</dd> <dt><code>Generator.prototype.close()</code> {{non-standard_inline}}</dt> - <dd>关闭生成器,因此执行该函数后调用<code>next()函数时将会抛出</code> {{jsxref("StopIteration")}} 错误. 与ES2015 生成器对象的<span style="font-family: courier,andale mono,monospace;">return()方法对应</span>..</dd> + <dd>关闭生成器,因此执行该函数后调用<code>next()函数时将会抛出</code> {{jsxref("StopIteration")}} 错误. 与ES2015 生成器对象的return()方法对应..</dd> <dt><code>Generator.prototype.send()</code> {{non-standard_inline}}</dt> <dd>用于将值发送到生成器。 该值由 {{jsxref("Operators/yield", "yield")}} 表达式返回, 并且返回下一个 {{jsxref("Operators/yield", "yield")}} 表达式产生的值. <code>send(x)</code> 对应于ES2015生成器对象中的 <code>next(x)</code></dd> <dt><strong><code>Generator.</code></strong><code>prototype.</code><strong><code>throw()</code> </strong> {{non-standard_inline}}</dt> - <dd>向生成器抛出错误. 与ES2015 生成器对象的<span style="font-family: courier,andale mono,monospace;">throw()方法对应</span>.</dd> + <dd>向生成器抛出错误. 与ES2015 生成器对象的throw()方法对应.</dd> </dl> <h3 id="旧生成器对象示例">旧生成器对象示例</h3> diff --git a/files/zh-cn/web/javascript/reference/global_objects/generator/throw/index.html b/files/zh-cn/web/javascript/reference/global_objects/generator/throw/index.html index 13138d5484..fec5b2f93c 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/generator/throw/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/generator/throw/index.html @@ -44,7 +44,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Generator/throw <h3 id="Example:_Using_test" name="Example:_Using_test">使用 <code>throw()</code></h3> -<p>下面的例子展示了一个简单的生成器并使用 <span style="font-family: courier,andale mono,monospace;">throw方法</span>向该生成器抛出一个异常,该异常通常可以通过 <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/try...catch">try...catch</a></code> 块进行捕获.</p> +<p>下面的例子展示了一个简单的生成器并使用 throw方法向该生成器抛出一个异常,该异常通常可以通过 <code><a href="/en-US/docs/Web/JavaScript/Reference/Statements/try...catch">try...catch</a></code> 块进行捕获.</p> <pre class="brush: js">function* gen() { while(true) { |