Roman Range is an iterator that:
- Receives a non-negative integer n
- Constructs an array of integers from 1 to n
- Maps the array to roman numers with intToRoman()
- Defines a Symbol.iterator method for iterating over the numerals array
Learn more about my implementation here.
Credit goes to dcode's youtube video for a great explanation on iterators.
for (numeral of new RomanRange(10)) {
console.log(numeral)
}
/*
Prints:
I
II
III
IV
V
VI
VII
VIII
IX
X
*/