Example: Generate Range of Characters
Output
[1, 2, 3, 4, 5] ["A", "B", "C", "D", "E", "F", "G"]
In the above program, a range of numbers and characters is generated between the upper and the lower bounds.
- The
iterategenerator function is used to iterate through lower and upper bounds. - The spread syntax
...is then used to include all the elements returned by theiteratefunction. - The
charCodeAt()method takes in an index value and returns an integer representing its UTF-16 (16-bit Unicode Transformation Format) code. - The
map()method iterates through all the array elements. - The
fromCharCode()method converts Unicode values into characters.