lisovaccaro lisovaccaro - 1 year ago 90
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?

Answer Source

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

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