From de5c456ebded0e038adbf23db34cc290c8829180 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:49:24 +0100 Subject: unslug pl: move --- .../reference/global_objects/array/keys/index.html | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 files/pl/web/javascript/reference/global_objects/array/keys/index.html (limited to 'files/pl/web/javascript/reference/global_objects/array/keys') diff --git a/files/pl/web/javascript/reference/global_objects/array/keys/index.html b/files/pl/web/javascript/reference/global_objects/array/keys/index.html new file mode 100644 index 0000000000..4ab6d7e18e --- /dev/null +++ b/files/pl/web/javascript/reference/global_objects/array/keys/index.html @@ -0,0 +1,120 @@ +--- +title: Array.prototype.keys() +slug: Web/JavaScript/Referencje/Obiekty/Array/keys +translation_of: Web/JavaScript/Reference/Global_Objects/Array/keys +--- +
{{JSRef}}
+ +

Metoda keys() zwraca nowy obiekt typu Array Iterator zawierający indeksy kolejnych elementów tablicy.

+ +
var arr = ['a', 'b', 'c'];
+var iterator = arr.keys();
+
+console.log(iterator.next()); // { value: 0, done: false }
+console.log(iterator.next()); // { value: 1, done: false }
+console.log(iterator.next()); // { value: 2, done: false }
+console.log(iterator.next()); // { value: undefined, done: true }
+
+ +

Składnia

+ +
arr.keys()
+ +

Zwracana wartość

+ +

Nowy iterator dla typu {{jsxref("Array")}}.

+ +

Przykłady

+ +

Iterator nie ignoruje dziur

+ +
var arr = ['a', , 'c'];
+var sparseKeys = Object.keys(arr);
+var denseKeys = [...arr.keys()];
+console.log(sparseKeys); // ['0', '2']
+console.log(denseKeys);  // [0, 1, 2]
+
+ +

Specyfikacje

+ + + + + + + + + + + + + + + + + + + +
SpecyfikacjaStatusKomentarz
{{SpecName('ES2015', '#sec-array.prototype.keys', 'Array.prototype.keys')}}{{Spec2('ES2015')}}Pierwsze wystąpienie.
{{SpecName('ESDraft', '#sec-array.prototype.keys', 'Array.prototype.keys')}}{{Spec2('ESDraft')}} 
+ +

Kompatybilność z przeglądarkami

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)EdgeInternet ExplorerOperaSafari
Basic support{{CompatChrome("38")}}{{CompatGeckoDesktop("28")}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("28")}}{{CompatNo}}{{CompatNo}}8.0
+
+ +

Zobacz również

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