1arr = []; // set array=[]
2
3//function
4const empty = arr => arr.length = 0;
5//example
6var arr= [1,2,3,4,5];
7empty(arr) // arr=[]
1// define Array
2let list = [1, 2, 3, 4];
3function empty() {
4 //empty your array
5 list = [];
6}
7empty();
8
1let list = [1, 2, 3, 4];
2function empty() {
3 //empty your array
4 list.length = 0;
5}
6empty();
7
1const array: Array<number> = new Array<number>();
2
3array.push(1);
4array.push(2);
5array.push(3);
6array.push(4);
7// has now 4 elemnts
8
9array = [];
10
11// has now 0 elements