1let arr =["a","b","c"];
2// ES6 way
3const copy = [...arr];
4
5// older method
6const copy = Array.from(arr);
1arr = []; // set array=[]
2
3//function
4const empty = arr => arr.length = 0;
5//example
6var arr= [1,2,3,4,5];
7empty(arr) // arr=[]
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());