I don\'t get how hard it is to discern a string containing a number from other strings in JavaScript.
Number(\'\') evaluates to 0, while
Number(\'\')
0
There's this simple solution :
var ok = parseFloat(s)==s;
If you need to consider "2 " as not a number, then you might use this one :
"2 "
var ok = !!(+s==s && s.length && s.trim()==s);