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

This commit is contained in:
2020-07-12 15:17:13 +05:30
parent 3d9635b313
commit aa1ba74ef0
+1 -1
View File
@@ -2,7 +2,7 @@
We use `[...someArray]` or `array.values()` to get multiple values out of a array. And we kind of know how it works - it just returns us all the values from the array. Internally, both of them uses the iterator protocol - which is already defined on array prototype.
But do we really know the details of how in-built Array iterator works? Can you write a precise polyfill to implement iterator protocol on Array?
But do we know exactly how the in-built Array iterator works? Can you write a precise polyfill to implement iterator protocol on Array?
## A little about the iterator protocol