JSFiddle - React, Tailwind, and code Playground

by guyluchenbill

JavaScript

var x = '3';

if (typeof x != "String") {
    str = x.toString();
    (str.match(/([0-9]+[\.|,][0-9]*)|([0-9]*[\.|,][0-9]+)|([0-9]+)/)) ? alert('true') : alert('false');
} else {
    (x.match(/([0-9]+[\.|,][0-9]*)|([0-9]*[\.|,][0-9]+)|([0-9]+)/)) ? alert('true') : alert('false');
}