Is there a way to empty an array and if so possibly with .remove() ?(有没有一种方法可以清空数组,如果可以的话,可以使用.remove()吗?)
.remove()
A = [1,2,3,4];
Ways to clear an existing array A :(清除现有数组A :)
A
A = [];
var arr1 = ['a','b','c','d','e','f']; var arr2 = arr1; // Reference arr1 by another variable arr1 = []; console.log(arr2); // Output ['a','b','c','d','e','f']
A.length = 0
A.splice(0,A.length)
.splice()
while(A.length > 0) { A.pop(); }
1.4m articles
1.4m replys
5 comments
57.0k users