mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 15:54:22 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,20 +2,20 @@
|
||||
<div></div>
|
||||
<p><strong><code>[@@iterator]()</code></strong> 方法返回一个新的Iterator对象,它遍历字符串的代码点,返回每一个代码点的字符串值。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><var>string</var>[Symbol.iterator]</code></pre>
|
||||
<pre><code class="language-javascript"><code><var>string</var>[Symbol.iterator]</code></code></pre>
|
||||
<h3 id="返回值">返回值</h3>
|
||||
<p>一个新的Iterator对象。</p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="使用iterator()"><code>使用[@@iterator]()</code></h3>
|
||||
<pre class="brush:js">var string = 'A\uD835\uDC68';
|
||||
<pre><code class="language-js">var string = 'A\uD835\uDC68';
|
||||
|
||||
var strIter = string[Symbol.iterator]();
|
||||
|
||||
console.log(strIter.next().value); // "A"
|
||||
console.log(strIter.next().value); // "\uD835\uDC68"
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="通过_for..of_使用iterator()"><code>通过</code> <code>for..of 使用[@@iterator]()</code></h3>
|
||||
<pre class="brush:js">var string = 'A\uD835\uDC68B\uD835\uDC69C\uD835\uDC6A';
|
||||
<pre><code class="language-js">var string = 'A\uD835\uDC68B\uD835\uDC69C\uD835\uDC6A';
|
||||
|
||||
for (var v of string) {
|
||||
console.log(v);
|
||||
@@ -26,7 +26,7 @@ for (var v of string) {
|
||||
// "\uD835\uDC69"
|
||||
// "C"
|
||||
// "\uD835\uDC6A"
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user