24
rated 0 times
[
26]
[
2]
/ answers: 1 / hits: 19771
/ 14 Years ago, fri, october 1, 2010, 12:00:00
whats the best way to tell if a value in javascript is a single digit. Ive been doing something like
var valAsString = '' + val;
if (valAsString.match(/d/) {}
clarification: I mean one of 0,1,2,3,4,5,6,7,8,9
Also, should what I have work? Im surprised how many different ways people are coming up with for this.
More From » regex