lisovaccaro lisovaccaro - 10 months ago 60
Javascript Question

Check if character is number?

I need to check whether


The string is something like: "blabla,120"

In this case it would check whether '0' is a number. How can this be done?


Just use isNaN() to check if it is not a number:

if (!isNaN(parseInt(justPrices[i].substr(commapos + 2, 1), 10))) {
  // Is a number