Simple question –
How do I convert a string that has been through parseInt back to it’ string value?
var myInt = parseInt('J', 36); //19
var myString = myInt.toString(); //returns "19" I would like it to return "J"
Can I do it with longer strings?
var myInt = parseInt("Jon o'reiley", 36); //25511
When converting a string to an int, information of the base the string used is lost. Also any data that was ignored while parsing is lost.
However, just like
parseInttoStringhas a base argument, too:Demo from the JS shell: