Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 30, 2022 04:25 pm GMT

Javascript: Different ways to convert numbers into alphabets

Expectation: 1 -> a, 2 -> b, 3 -> c etc.

(5 + 9).toString(36); -> e
String.fromCharCode(5 + 'A'.charCodeAt()); -> e

In both, replace 5 with other number from 1 - 26. You will get corresponding alphabet.

Always, welcome any new approaches.

You can follow me here: https://twitter.com/urstrulyvishwak

Thanks.


Original Link: https://dev.to/urstrulyvishwak/javascript-different-ways-to-convert-numbers-into-alphabets-420j

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To