I am trying to convert text (E.g. Hello) to a number (E.g. 0805121215).
I have looked up many sources, but none of them have worked.
I have tried:
https://dev.to/sanchithasr/7-ways-to-convert-a-string-to-number-in-javascript-4l
and
thttps://www.geeksforgeeks.org/convert-a-string-to-an-integer-in-javascript/
I tried a few more sources but they all say that text outputs as NaN. I would like it to convert to a number, I don’t want Not a Number.
Here is an example of what I want to happen:
https://scratch.mit.edu/projects/948090655/
2
Answers
Like this?
first you need to define each letter to it’s number and each number to it’s letter
then you would grab the letter from the inputted number or the number from the inputted letter
the challange was reversing numbers back to letters in this case because the function will match each number to it’s corresponding letter, so i made each letter have 2 numbers and now when the functions reverse the number it will do that with 2 numbers at the time knowing that each 2 numbers is a letter.
Example here
https://jsfiddle.net/3m2hj1a7/1/