Javascript Data Type Checker Is Number

Description

Javascript Data Type Checker Is Number


// Checks to see if something is a number
Object.isNumber = function(obj) {
    return typeof obj == 'number' && isFinite(obj);
}

let a = 123;/*ww  w.  j a  va2s . c  om*/
console.log(Object.isNumber(a));



PreviousNext

Related