Is int and is percent - Node.js Math

Node.js examples for Math:Math Function

Description

Is int and is percent

Demo Code

function isInt(x) {
     var y=parseInt(x);
     if (isNaN(y)) return false;
     return x==y && x.toString()==y.toString();
}

function isPercent(x){

  return isInt(x)&&parseInt(x)<=100;

}

Related Tutorials