Nodejs Number to Int Convert to_i()

Here you can find the source of to_i()

Method Source Code

Number.prototype.to_i = function () {
  return parseInt(this.valueOf());
};

Related

  1. toInt()
    Number.prototype.toInt = function() {
      return (this | 0);
    };
    
  2. toInt()
    Number.prototype.toInt = function(){
      return parseInt(this);
    };
    
  3. toIntZero()
    Number.prototype.toIntZero = function(){
      var val = parseInt(this);
      if(isNaN(val)){
        return 0;
      }else{
        return val
    };
    var cards = angular.module('app', []);
    ...
    
  4. toInteger( thousandsSeparator )
    Number.prototype.toInteger = function ( thousandsSeparator ) {
        var n, startAt, intLen;
        if ( thousandsSeparator == null ) thousandsSeparator = ",";
        n = this.round( 0, true );
        intLen = n.length;
        if ( (startAt = intLen % 3) == 0 ) startAt = 3;
        for ( var i = 0, len = Math.ceil( intLen / 3 ) - 1; i < len; i++ )n = n.insertAt( i * 4 + startAt, thousandsSeparator );
        return n;
    };
    ...
    
  5. to_i()
    Number.prototype.to_i = function() {
        return Math.floor(this);
    };
    console.log((5.276).to_i());
    _n = function(operateOn){
        self = {}
        self.to_i = function() {
            return Math.floor(operateOn);
        };
    ...