🔸make-iterator method
JS⟩ iteration ⟩ iterable ⟩ make-iterator method
we can implement the make-iterator method by:
returning iterator object directly ( 👉 see: ClosedRange)
using generator function.
similar to .makeIterator() method of Sequence protocol in Swift
By default, using array[Symbol.iterator] will return the values()
function.
do NOT use @@iterator as the method name, it's just a "specification" thing❗️
Last updated