Nodejs Number Abstract Value Get absRound(number)

Here you can find the source of absRound(number)

Method Source Code


/**/*from   w  w w  . j a va2 s . c  om*/
 *
 * @param number
 * @returns {number}
 */
function absRound(number) {
    if (number < 0) {
        return Math.ceil(number);
    } else {
        return Math.floor(number);
    }
}

Related

  1. abs()
    Number.prototype.define("abs", function() {
      return Math.abs(this)
    })
    
  2. abs()
    Number.prototype.abs = function () {
      return Math.abs(this.valueOf());
    
  3. abs()
    Number.prototype.abs = function(){
        return Math.abs(this);
    };