DEV Community

Kurapati Mahesh
Kurapati Mahesh

Posted on

2 2

Javascript: Different ways to convert numbers into alphabets

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

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

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

Always, welcome any new approaches.

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

Thanks.

Top comments (0)

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay