在update中调用addBalls函数时,if使用嵌套的方式会使性能更好吗?
像这样
if(curSeconds!==nextSeconds){
addBalls(MARGIN_LEFT+46.5*square, MARGIN_TOP, nextSeconds%10);
if(parseInt(curSeconds/10)!==parseInt(nextSeconds/10)){
addBalls(MARGIN_LEFT+39*square, MARGIN_TOP, parseInt(nextSeconds/10));
if(curMinutes%10!==nextMinutes%10){
addBalls(MARGIN_LEFT+27*square, MARGIN_TOP, curMinutes%10);
if(parseInt(curMinutes/10)!==parseInt(nextMinutes/10)){
addBalls(MARGIN_LEFT+19.5*square, MARGIN_TOP, parseInt(curMinutes/10));
if(curHours%10!==nextHours%10){
addBalls(MARGIN_LEFT+7.5*square, MARGIN_TOP, curHours%10);
if(parseInt(curHours/10)!==parseInt(nextHours/10)){
addBalls(MARGIN_LEFT, MARGIN_TOP, parseInt(curHours/10));
}
}
}
}
}
curTimeSeconds=nextTimeSeconds;
}