mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-17 08:26:32 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/map-prototype-set.html" width="100%"></iframe></div>
|
||||
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>myMap</em>.set(key, value);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>myMap</em>.set(key, value);</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>key</dt>
|
||||
@@ -16,7 +16,7 @@
|
||||
<p><code>Map</code> 对象</p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="使用_set_方法">使用 <code>set</code> 方法</h3>
|
||||
<pre class="brush: js">var myMap = new Map();
|
||||
<pre><code class="language-javascript">var myMap = new Map();
|
||||
|
||||
// 将一个新元素添加到 Map 对象
|
||||
myMap.set("bar", "foo");
|
||||
@@ -24,14 +24,14 @@ myMap.set(1, "foobar");
|
||||
|
||||
// 在Map对象中更新某个元素的值
|
||||
myMap.set("bar", "baz");
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="Using_the_set_method_with_chaining">Using the <code>set</code> method with chaining</h3>
|
||||
<p>因为 Set() 方法返回 Map 对象本身,所以你可以像下面这样链式调用它:</p>
|
||||
<pre class="brush: js">// Add new elements to the map with chaining.
|
||||
<pre><code class="language-javascript">// Add new elements to the map with chaining.
|
||||
myMap.set('bar', 'foo')
|
||||
.set(1, 'foobar')
|
||||
.set(2, 'baz');
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user