Tuesday, July 7, 2009

Math.round decimal places

Here is some rounding help. This converts miliseconds to seconds with two decimal places. Note the "/10) * 10" part, that rounds it to 2 decimal places, "/100) * 100" would round it to one decimal place.

_secondsRound = Math.round(_theSound.length / 10) * 10 / 1000;

No comments:

Post a Comment