quarta-feira, 11 de julho de 2012

Simple Round JavaScript Number

 The simple script to Round Number, remember, in JavaScript you should convert the number using ParseFloat()

Ex:



function myRound(num, dec) {
      return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
        }


alert(myRound(parseFloat(15000) / 100) * 78, 2));
Postar um comentário