Nice.
How about creating your own class that extends Date and then adding the Symbol.iterator to it. That way you don't change the global Date object.
If ECMA adds some kind of interation to Date in the future it won't affect your code and it makes your code more explicit. new CustomDate()
Nice.
How about creating your own class that extends
Date
and then adding theSymbol.iterator
to it. That way you don't change the globalDate
object.If ECMA adds some kind of interation to
Date
in the future it won't affect your code and it makes your code more explicit.new CustomDate()
Nice job once again
You are right. As said in the article, you can also make any classes or objects iterable. This also includes your custom date object.