其中删除小球那块儿代码把括号补全是怎么样的呢 都试过了也不对呀
var cnt = 0
for( var i = 0 ; i < balls.length ; i ++ )
if( balls[i].x + RADIUS > 0 && balls[i].x -RADIUS < WINDOW_WIDTH )
balls[cnt++] = balls[i]
while( balls.length > cnt ){
balls.pop();
}
console.log(balls.length);
var cnt = 0
for( var i = 0 ; i < balls.length ; i ++ )
if( balls[i].x + RADIUS > 0 && balls[i].x -RADIUS < WINDOW_WIDTH )
balls[cnt++] = balls[i]
while( balls.length > cnt ){
balls.pop();
}
console.log(balls.length);
2015-01-11
举报