From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../global_objects/set/entries/index.html | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/set/entries/index.html (limited to 'files/ja/web/javascript/reference/global_objects/set/entries') diff --git a/files/ja/web/javascript/reference/global_objects/set/entries/index.html b/files/ja/web/javascript/reference/global_objects/set/entries/index.html new file mode 100644 index 0000000000..641a865ad0 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/set/entries/index.html @@ -0,0 +1,71 @@ +--- +title: Set.prototype.entries() +slug: Web/JavaScript/Reference/Global_Objects/Set/entries +tags: + - ECMAScript 2015 + - Iterator + - JavaScript + - Method + - Prototype + - set +translation_of: Web/JavaScript/Reference/Global_Objects/Set/entries +--- +
{{JSRef}}
+ +

entries() メソッドは、Set オブジェクトの各要素を挿入順に [value, value] の配列を含む新しいイテレーターオブジェクトを返します。Set オブジェクトは、Map オブジェクトのように key を持つことはありません。しかしながら、Map オブジェクトと似た API をもつために、各 entrykeyvalue に対して同じ値を持ちます。そのため、配列 [value, value] が返されます。

+ +
{{EmbedInteractiveExample("pages/js/set-prototype-entries.html")}}
+ + + +

構文

+ +
mySet.entries()
+ +

返値

+ +

Set オブジェクトの各要素を挿入順に [value, value] の配列を含む新しい Iterator オブジェクトです。

+ +

+ +

entries() を使う

+ +
var mySet = new Set();
+mySet.add('foobar');
+mySet.add(1);
+mySet.add('baz');
+
+var setIter = mySet.entries();
+
+console.log(setIter.next().value); // ["foobar", "foobar"]
+console.log(setIter.next().value); // [1, 1]
+console.log(setIter.next().value); // ["baz", "baz"]
+
+ +

仕様

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-set.prototype.entries', 'Set.prototype.entries')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("javascript.builtins.Set.entries")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf