diff options
author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-09-16 23:42:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 23:42:30 +0900 |
commit | 3b2a44df5119dc483bf52af989bc90d8c3c58d7f (patch) | |
tree | 2dd5b795071714988803b02e88d37d5cf70a967d /files/ja | |
parent | 49480fd1cc43cad88bea216b4508ca6f8a19f313 (diff) | |
download | translated-content-3b2a44df5119dc483bf52af989bc90d8c3c58d7f.tar.gz translated-content-3b2a44df5119dc483bf52af989bc90d8c3c58d7f.tar.bz2 translated-content-3b2a44df5119dc483bf52af989bc90d8c3c58d7f.zip |
orphaned/Map を削除 (#2339)
古い文章であるため、現在の JavaScript の Map へのリダイレクトに変更
Diffstat (limited to 'files/ja')
-rw-r--r-- | files/ja/_redirects.txt | 2 | ||||
-rw-r--r-- | files/ja/_wikihistory.json | 7 | ||||
-rw-r--r-- | files/ja/orphaned/map/index.html | 230 |
3 files changed, 1 insertions, 238 deletions
diff --git a/files/ja/_redirects.txt b/files/ja/_redirects.txt index 2fd494e351..8e84bae6f8 100644 --- a/files/ja/_redirects.txt +++ b/files/ja/_redirects.txt @@ -2770,7 +2770,7 @@ /ja/docs/MDN_at_ten /ja/docs/MDN/At_ten /ja/docs/MDN_at_ten/Contributing_to_MDN /ja/docs/MDN/Contribute /ja/docs/MDN_at_ten/History_of_MDN /ja/docs/MDN/At_ten/History_of_MDN -/ja/docs/Map /ja/docs/orphaned/Map +/ja/docs/Map /ja/docs/Web/JavaScript/Reference/Global_Objects/Map /ja/docs/MathML /ja/docs/Web/MathML /ja/docs/MathML/Element /ja/docs/Web/MathML/Element /ja/docs/MathML/Element/math /ja/docs/Web/MathML/Element/math diff --git a/files/ja/_wikihistory.json b/files/ja/_wikihistory.json index de3c610c46..4cd7db3240 100644 --- a/files/ja/_wikihistory.json +++ b/files/ja/_wikihistory.json @@ -48627,13 +48627,6 @@ "Potappo" ] }, - "orphaned/Map": { - "modified": "2019-03-23T23:22:54.998Z", - "contributors": [ - "wbamberg", - "ledsun" - ] - }, "orphaned/Microsummary_XML_grammar_reference": { "modified": "2019-03-23T23:42:58.294Z", "contributors": [ diff --git a/files/ja/orphaned/map/index.html b/files/ja/orphaned/map/index.html deleted file mode 100644 index 970083dc95..0000000000 --- a/files/ja/orphaned/map/index.html +++ /dev/null @@ -1,230 +0,0 @@ ---- -title: Map -slug: orphaned/Map -original_slug: Map ---- -<p><span style="line-height: 1.5;">{{ SeeCompatTable() }}</span></p> - -<p>{{ warning("The SpiderMonkey Map implementation is a prototype and the Map API and semantics specifications are unstable. The SpiderMonkey implementation may not reflect the latest specification draft. It is subject to change anytime. It is provided as an experimental feature. Do not rely on it for production code.") }}</p> - -<h2 id="Introduction">Introduction</h2> - -<p><code>Map</code> <span style="line-height: 1.5;">オブジェクトはシンプルなキーバリューマップです。 キーとバリューにあらゆる値(オブジェクトとプリミティブ値)が使用できます。</span></p> - -<p>Key equality is based on the "same-value" algorithm: <code>NaN</code> is considered the same as <code>NaN</code> (even though <code>NaN !== NaN</code>), <code>-0</code> and <code>+0</code> are considered distinct (even though <code>-0 === +0</code>), and all other values are considered equal according to the semantics of the === operator.</p> - -<h2 id="API">API</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th>Constructor</th> - <th>Description</th> - </tr> - <tr> - <td><code>new Map([iterable])</code></td> - <td>Returns a new Map object. If iterable is an Array or other iterable object whose elements are key-value pairs (2-element Arrays), then each of those key-value pairs will be added to the new Map.</td> - </tr> - <tr> - <th>Method</th> - <th>Description</th> - </tr> - <tr> - <td><code>myMap.get(key)</code></td> - <td>Returns the value associated to the <code>key</code>, or <code>undefined</code> if there is none.</td> - </tr> - <tr> - <td><code>myMap.set(key, value)</code></td> - <td>Sets the value for the <code>key</code> in <code>myMap</code>. Returns <code>undefined</code>.</td> - </tr> - <tr> - <td><code>myMap.has(key)</code></td> - <td>Returns a boolean asserting whether a value has been associated to the <code>key</code> in <code>myMap</code> or not</td> - </tr> - <tr> - <td><code>myMap.delete(key)</code></td> - <td>Removes any value associated to the <code>key</code>. After such a call, <code>myMap.has(key)</code> will return <code>false</code>.</td> - </tr> - <tr> - <td><code>myMap.clear()</code></td> - <td>Removes all key/value pairs from <code>myMap</code>.</td> - </tr> - <tr> - <th>Property</th> - <th>Description</th> - </tr> - <tr> - <td><code>myMap.size</code></td> - <td> - <p>Returns the number of key/value pairs in <code>myMap</code>.</p> - In Firefox 18 and earlier, <code>size</code> was a method. In Firefox 19 and later it is a property.</td> - </tr> - </tbody> -</table> - -<p>A Map object can iterate its elements in insertion order - a <code>for..of</code> loop will return an array of <code>[key, value]</code> for each iteration.</p> - -<h2 id="Examples">Examples</h2> - -<pre class="brush: js">var myMap = new Map(); - -var keyObj = {}, - keyFunc = function () {}, - keyString = "a string"; - -// setting the values -myMap.set(keyString, "value associated with 'a string'"); -myMap.set(keyObj, "value associated with keyObj"); -myMap.set(keyFunc, "value associated with keyFunc"); - -myMap.size; // 3 - -// getting the values -myMap.get(keyString); // "value associated with 'a string'" -myMap.get(keyObj); // "value associated with keyObj" -myMap.get(keyFunc); // "value associated with keyFunc" - -myMap.get("a string"); // "value associated with 'a string'" - // because keyString === 'a string' -myMap.get({}); // undefined, because keyObj !== {} -myMap.get(function() {}) // undefined, because keyFunc !== function () {} -</pre> - -<p><code>NaN</code> can also be used as a key. Even though every <code>NaN</code> is not equal to itself (<code>NaN !== NaN</code> is true), the following example works, because <code>NaN</code>s are indistinguishable from each other:</p> - -<pre class="brush: js">var myMap = new Map(); -myMap.set(NaN, "not a number"); - -myMap.get(NaN); // "not a number" - -var otherNaN = Number("foo"); -myMap.get(otherNaN); // "not a number" -</pre> - -<p>Also note that JavaScript has two zero values, +0 and -0. These two zero values are treated as different keys in <code>Map</code>s:</p> - -<pre class="brush: js">var myMap = new Map(); -myMap.set(0, "positive zero"); -myMap.set(-0, "negative zero"); - -0 === -0; // true - -myMap.get(-0); // "negative zero" -myMap.get(0); // "positive zero" -</pre> - -<p>Maps can be iterated using a <code>for..of</code> loop:</p> - -<pre>var myMap = new Map(); -myMap.set(0, "zero"); -myMap.set(1, "one"); -for (var [key, value] of myMap) { - alert(key + " = " + value); -} -// Will show 2 alerts; first with "0 = zero" and second with "1 = one" -</pre> - -<h2 id="Objects_and_maps_compared">Objects and maps compared</h2> - -<p><a href="/en/JavaScript/Reference/Global_Objects/Object" title="en/JavaScript/Reference/Global_Objects/Object"><code>Object</code></a>s are similar to <code>Map</code>s in that both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. Because of this, <code>Object</code>s have been used as <code>Map</code>s historically; however, there are important differences between <code>Object</code>s and <code>Map</code>s that make using a <code>Map</code> better.</p> - -<ul> - <li>An <code>Object</code> has a prototype, so there are default keys in the map. However, this can be bypassed using <code>map = Object.create(null)</code>.</li> - <li>The keys of an <code>Object</code> are <a href="/en/JavaScript/Reference/Global_Objects/String" title="en/JavaScript/Reference/Global_Objects/String">String</a>s, where they can be any value for a <code>Map</code>.</li> - <li>You can get the size of a <code>Map</code> easily while you have to manually keep track of size for an <code>Object</code>.</li> -</ul> - -<p>Use maps over objects when keys are unknown until run time, and when all keys are the same type and all values are the same type.</p> - -<p>Use objects when there is logic that operates on individual elements.</p> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - -<p>{{ CompatibilityTable() }}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>31 [1]</td> - <td>{{ CompatGeckoDesktop("13") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - <tr> - <td>iterable</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatGeckoDesktop("17") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - <tr> - <td>Map.clear()</td> - <td>31 [1]</td> - <td>{{CompatGeckoDesktop("19")}}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatGeckoMobile("13") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - <tr> - <td>iterable</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatGeckoDesktop("17") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - <tr> - <td>Map.clear()</td> - <td>{{ CompatNo() }}</td> - <td>{{CompatGeckoMobile("19")}}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - </tbody> -</table> -</div> - -<p>[1] The feature is available behind a preference. In <code style="font-size: 14px;">chrome://flags</code>, activate the entry “Enable Experimental JavaScript”.</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li><a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=697479">Map and Set bug at Mozilla</a></li> - <li><a class="external" href="http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets">ECMAScript Harmony proposal</a></li> -</ul> |