Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js is numeric

function isNumeric(num) {
    if (num === '' || num === null) {
        return false
    }
    return !isNaN(num)
}

isNumeric('') //false
isNumeric('7') //true
isNumeric(7) //true
isNumeric('7a') //false
isNumeric('a') //false
isNumeric(null) //false
isNumeric(0) //true
isNumeric('0') //true
isNumeric(true) //true
isNumeric(false) //true
 
PREVIOUS NEXT
Tagged: #js #numeric
ADD COMMENT
Topic
Name
2+1 =