Rounding off decimal place


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function roundOff ( value : Number, decimalPlaces : int ) : Number {
  2. var k : int = Math.pow ( 10, decimalPlaces );
  3.  
  4. value *= k;
  5. value = Math.round ( value );
  6.  
  7. return value / k;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.