How to empty an array
This question already has an answer here:
There are 2 options:
1) Modify the length
property
var wall = new Array(),
wall.push(new Rectangle(30, 50, 10, 10));
wall.length = 0;
2) Use the splice()
method
wall.splice(0);
Check this interesting article about the length
property.
下一篇: 如何清空数组