Showing posts with label Numeric. Show all posts
Showing posts with label Numeric. Show all posts

Tuesday, June 25, 2013

Javascript: Function to check if the string is numeric (i.e. valid number)

Following is the javascript function which accurately validates if the supplied string a valid number or not.

function isNumber(n) {
    return !isNaN(parseFloat(n)) && isFinite(n);
}