Javascript Number round( a )

Description

Javascript Number round( a )


Number.prototype.round = function( a ){
 
 if( (this+"").includes("e") ){
  return +(Math.round(this)+'e-'+a);
 }
 else{//from  ww w  . j  a v  a 2 s  .  c om
  return +(Math.round(this+'e+'+a)+'e-'+a);
 }
 
}



PreviousNext

Related