update post: How does in-built Array iterator work?

This commit is contained in:
2020-07-12 15:18:05 +05:30
parent aa1ba74ef0
commit acd942d399
+1 -1
View File
@@ -19,7 +19,7 @@ This is how the iterable/iterator stuff works.
In our case, Iterable is `someArray` - which has a special property `Symbol.iterator` whose value is a method. Calling this method returns a iterable (`iter`), which has `.next()` method. Calling this method returns all the values one-by-one.
## On arrays
## ArrayIterator
Array has in-built support for iterable/iterator protocol, through prototype. Array.prototype has a method with key `Symbol.iterator`, which creates a ArrayIterator.