xpedobearx xpedobearx - 1 year ago 95
Javascript Question

Convert number to alphabet letter

I want to convert a number to its corresponding alphabet letter. For example:

1 = A
2 = B
3 = C

Can this be done in javascript without manually creating the array?
In php there is a range() function that creates the array automatically. Anything similar in javascript?


Yes, with Number#toString(36) and an adjustment.

var value = 10;

document.write((value + 9).toString(36).toUpperCase());