🔰make iterables
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS⟩ iteration ⟩ iterable ⟩ make iterables
we can make class/object iterable by letting them:
make iterator object directly ( 👉 see: ClosedRange)
return new using ( 👉 see:� )
use generator function to return new iterator.
💾 replit:make class iterable
// an iterable (that can make iterators)
class ValueContainer {
// private properties
#values;
// init
constructor(...values) {
this.#values = values;
}