From 3601b7bb982e958927e069715cfe07430bce7196 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 15 Jul 2021 12:59:34 -0400 Subject: delete pages that were never translated from en-US (es, part 1) (#1547) --- .../the_legacy_iterator_protocol/index.html | 74 ---------------------- 1 file changed, 74 deletions(-) delete mode 100644 files/es/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html (limited to 'files/es/web/javascript/reference/deprecated_and_obsolete_features') diff --git a/files/es/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html b/files/es/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html deleted file mode 100644 index 007decfe89..0000000000 --- a/files/es/web/javascript/reference/deprecated_and_obsolete_features/the_legacy_iterator_protocol/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: The legacy Iterator protocol -slug: >- - Web/JavaScript/Reference/Deprecated_and_obsolete_features/The_legacy_Iterator_protocol -translation_of: >- - Web/JavaScript/Reference/Deprecated_and_obsolete_features/The_legacy_Iterator_protocol -original_slug: >- - Web/JavaScript/Referencia/Características_Desaprobadas/The_legacy_Iterator_protocol ---- -
{{jsSidebar("More")}}
- -
Non-standard. The legacy iterator protocol is a SpiderMonkey-specific feature, and will be removed at some point. For future-facing usages, consider using for..of loops and the iterator protocol.
- -

The deprecated Firefox-only iterator protocol

- -

Firefox, prior to version 26 implemented another iterator protocol that is similar to the standard ES6 Iterator protocol.

- -

An object is an legacy iterator when it implements a next() method with the following semantics, and throws {{jsxref("Global_Objects/StopIteration", "StopIteration")}} at the end of iteration.

- - - - - - - - - - - - -
PropertyValue
nextA zero arguments function that returns an value.
- -

Difference between legacy and ES6 iterator protocols

- - - -

Simple example with the old protocol

- -
function makeIterator(array){
-    var nextIndex = 0;
-
-    return {
-       next: function(){
-           if(nextIndex < array.length){
-               return array[nextIndex++];
-           else
-               throw new StopIteration();
-       }
-    }
-}
-
-var it = makeIterator(['yo', 'ya']);
-
-console.log(it.next()); // 'yo'
-console.log(it.next()); // 'ya'
-try{
-    console.log(it.next());
-}
-catch(e){
-    if(e instanceof StopIteration){
-         // iteration over
-    }
-}
-
- -

Mira también

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