Convert integer into its character equivalent, where 0 => a, 1 => b, etc

前端 未结 12 862
无人共我
无人共我 2020-11-28 02:52

I want to convert an integer into its character equivalent based on the alphabet. For example:

0 => a
1 => b
2 => c
3 => d

etc.

12条回答
  •  感动是毒
    2020-11-28 03:33

    Use String.fromCharCode. This returns a string from a Unicode value, which matches the first 128 characters of ASCII.

    var a = String.fromCharCode(97);
    

提交回复
热议问题