Nodejs Number Value Check isNumeric()

Here you can find the source of isNumeric()

Method Source Code

/**//from   w  w  w  . j a v  a 2  s . c om
@Name: String.prototype.isNumeric
@Author: Paul Visco
@Version: 1.1 11/27/07
@Description: Checks to see if a string is numeric (a float or number)
@Return: Boolean True if the the string represnts numeric data, false otherwise
@Example:
var str = '12';

var answer = str.isNumeric();
//answer = true
*/
String.prototype.isNumeric = function() {
  return !isNaN(parseFloat(this)) && isFinite(this);
};

Related

  1. isNumber()
    String.prototype.isNumber = function (){
        var str = this;
        return !isNaN(str);
    
  2. isNumber()
    String.prototype.isNumber = function()
      return (/^\d+$/.test(this.Trim()));
    
  3. isNumber()
    String.prototype.isNumber = function()
      try
        var value = this.toString();
        value = value.replace(",","");
          if (parseFloat(value)!= value)
            return false;
          else
    ...
    
  4. isNumeric()
    String.prototype.isNumeric = function(){
        return !isNaN(parseFloat(this)) && isFinite(this);
    
  5. isNumeric()
    String.prototype.isNumeric = function() {
      return !isNaN(parseFloat(this)) && isFinite(this);
    };
    
  6. isNumeric()
    String.prototype.isNumeric = function() {
        var tmpFloat = parseFloat(this);
        if (isNaN(tmpFloat))
            return false;
        var tmpLen = this.length - tmpFloat.toString().length;
        return tmpFloat + "0".Repeat(tmpLen) == this;
    
  7. isNumeric()
    var postfixStack = new Array
    String.prototype.isNumeric = function() {
        return !isNaN(parseFloat(this)) && isFinite(this);
    function MathSolver() {
    this.infixToPostfix = function(infix) {
     for(var i = 0; i < infix.length; i++) {
                var token = infix[i];
                if(token.isNumeric()) {
    ...
    
  8. isNumeric(iLoc)
    String.prototype.isNumeric = function (iLoc) {
        iLoc = ((!!iLoc) ? iLoc : 0);
        iLoc = ((iLoc < 0) ? 0 : iLoc);
        iLoc = ((iLoc > (this.length - 1)) ? this.length : iLoc);
        var _ch = this.substr(iLoc, 1);
        var b = ( (_ch >= '0') && (_ch <= '9') );
        return b;
    
  9. isNumeric(value, isString)
    Number.isNumeric = function isNumeric(value, isString) {
        if (typeof value === "string" && isString) {
            return Number.isInteger(value, true) || Number.isFloat(value, true);
        return Number.isInteger(value) || Number.isFloat(value);
    };