// preceding code is determining the minutes
if(Math.round(sec) == 60)
{
min++;
sec = 0
}
else
{
// test case: 4.564983
sec = sec*Math.pow(10, 4);
sec = sec - sec%1;
sec = sec*Math.pow(10, -4)
sec = Math.round(sec*Math.pow(10, 1));
alert(sec) // -> 539
sec = sec - sec%1;
sec = sec*Math.pow(10, -1)
alert(sec) // -> 53.900000000000006 <<<<****
var tmp = sec%1;
sec = sec - tmp;
tmp = tmp*10;
tmp = tmp - tmp%1;
sec = sec+(tmp/10)
}
برچسب:
نویسنده: آیلین رضوانی