Nodejs Number Type Check isInt()

Here you can find the source of isInt()

Method Source Code

/**//from w  w  w  .j  av a2s  .  co m
 * Returns true if the number is an integer and false if its Number.NaN or a floating point number
 */
Number.prototype.isInt = function() {
   return parseFloat(this) == parseInt(this, 10) && !isNaN(this);
};

Related

  1. isInteger()
    Number.prototype.isInteger = function () {
        "use strict";
        var ans = false;
        if (this % 1 == 0) {
            ans = true;
        return ans;
    };
    
  2. isInteger()
    Number.prototype.isInteger = function(){
      var ans = false;
      if(this%1==0){
        ans = true;
      return ans;
    };
    
  3. isInteger()
    Number.prototype.isInteger = function(){
      var ans = false;
      if(this % 1 == 0){
        ans = true
      return ans;
    
  4. isNumber()
    var assert=require('assert');
    var Number=function(number){
        this.number = number;
    Number.prototype.isNumber=function(){
        return isNaN(this.number);
    Number.prototype.isEven=function(){
        return this.number%2==0;
    ...