1let aray = [1,2,3,4,5,6,7,8,9,10];
2
3//as with most coding there are several ways you can do anything
4//see whichever works best for your scenario
5
6//set the array to equal a blank array
7array = [];
8
9//set the array's length to 0
10array.length = 0;
11
12//using splice, starts at index 0 & removes everything up to and including that last index
13array.splice(0, array.length);
14
15//map or loop through and shift() or pop();
16//goes through the array one at a time and removes the last item each time
17array.map( () => array.pop());
18
19//goes through the array one at a time and removes the first item each time
20array.map( () => array.shift());
1
2
3var ar = [1, 2, 3, 4, 5, 6];
4//do stuffar = [];
5//a new, empty array!
6
7