JavaScript: Get the second digit from a number?
So you want to get the second digit from the decimal writing of a number. The simplest and most logical solution is to convert it to a string : var digit = (”+myVar)[1]; or var digit = myVar.toString()[1]; If you don’t want to do it the easy way, or if you want a more efficient … Read more