Using JavaScript’s replace and regex, how do I replace numbers 0-9 with the letters a-j ?
example mapping: 0 = a, 1 = b, 2 = c, 3 = d, 4 = e and so on.
so, before:
x = 3;
after:
x = 'd';
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Most straightforward for me is to simply map one value to another:
Of course, you can generate the mapping using less typing:
And if you need more complicated mapping you can always use an object: