Javascript String isNumeric()

Description

Javascript String isNumeric()


String.prototype.isNumeric = function() {
    return !isNaN(this);
};
String.prototype.capitalise = function() {
    return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
};

Javascript String isNumeric()

String.prototype.isNumeric = function() {
 return !isNaN(parseFloat(this)) && isFinite(this);
};

Javascript String isNumeric()

// extend the string prototype object to abstract generic functionality
String.prototype.isNumeric = function(){
    return !isNaN(parseFloat(this)) && isFinite(this);
}

Javascript String isNumeric()

var postfixStack = new Array

String.prototype.isNumeric = function() {
    return !isNaN(parseFloat(this)) && isFinite(this);
}


function MathSolver() {

this.infixToPostfix = function(infix) {
        //from   www.j  a v a2 s .co m

 for(var i = 0; i < infix.length; i++) {
            var token = infix[i];
            if(token.isNumeric()) {
                postfixStack.push(Number(token));       //SMM
            } 
       
        }
      
 }
   this.printStack = function() {
                return postfixStack;
   }
}


console.log(postfixStack)



PreviousNext

Related