I need to check whether justPrices[i].substr(commapos+2,1).
The string is something like: \"blabla,120\"
In this case it would check whether \'0
The shortest solution is:
const isCharDigit = n => n < 10;
You can apply these as well:
const isCharDigit = n => Boolean(++n);
const isCharDigit = n => '/' < n && n < ':';
const isCharDigit = n => !!++n;
if you want to check more than 1 chatacter, you might use next variants
Regular Expression:
const isDigit = n => /\d+/.test(n);
Comparison:
const isDigit = n => +n == n;
Check if it is not NaN
const isDigit = n => !isNaN(n);