From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- files/uk/archive/web/stopiteration/index.html | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 files/uk/archive/web/stopiteration/index.html (limited to 'files/uk/archive/web/stopiteration/index.html') diff --git a/files/uk/archive/web/stopiteration/index.html b/files/uk/archive/web/stopiteration/index.html new file mode 100644 index 0000000000..022bd6caff --- /dev/null +++ b/files/uk/archive/web/stopiteration/index.html @@ -0,0 +1,63 @@ +--- +title: StopIteration +slug: Archive/Web/StopIteration +tags: + - JavaScript + - застарілий +translation_of: Archive/Web/StopIteration +--- +
Нестандартний. Об'єкт StopIteration був особливою функціональністю SpiderMonkey та був прибраний у Firefox 58+. Для використання у майбутньому розгляньте цикли for..of та протоколи перебору.
+ +

Об'єкт StopIteration використовувався для повідомлення про закінчення перебору у протоколі застарілого ітератора. Не використовуйте цю давню функціональність.

+ +

Синтаксис

+ +
StopIteration
+ +

Опис

+ +

StopIteration є частиною протоколу застарілого ітератора та буде прибраний одночасно із застарілим ітератором та застарілим генератором.

+ +

Приклади

+ +

StopIteration викидається об'єктом Iterator.

+ +
var a = {
+  x: 10,
+  y: 20
+};
+var iter = Iterator(a);
+console.log(iter.next()); // ["x", 10]
+console.log(iter.next()); // ["y", 20]
+console.log(iter.next()); // викидає StopIteration
+
+ +

Викидання об'єкта StopIteration.

+ +
function f() {
+  yield 1;
+  yield 2;
+  throw StopIteration;
+  yield 3; // це не виконується.
+}
+
+for (var n in f()) {
+  console.log(n);   // 1
+                    // 2
+}
+
+ +

Специфікації

+ +

Нестандартний. Не є частиною жодних актуальних стандартів.

+ +

Сумісність з веб-переглядачами

+ +

Не підтримується. Використовувався у Firefox у версіях до Firefox 57.

+ +

Див. також

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