javascript清空数组
单击可清空
var GFG_Array = [1, 2, 3, 4, 5];
var up = document.getElementById("up");
up.innerHTML = "GFG_Array:"+GFG_Array;
var down = document.getElementById("down");
down.innerHTML = "GFG_Array的长度为:"
+ GFG_Array.length;
function empty() {
while(GFG_Array.length > 0) {
GFG_Array.pop();
}
down = document.getElementById("down");
down.innerHTML = "GFG_Array的长度为:"
+ GFG_Array.length;
down1 = document.getElementById("down1");
down1.innerHTML = "GFG_Array:"+GFG_Array;
}