To empty an array in Javascript, simply set the length of the array to 0.
See the example below.
let arr = [1,2,3,4];
console.log(arr); // 1,2,3,4
arr.length = 0;
console.log(arr); // []
To empty an array in Javascript, simply set the length of the array to 0.
See the example below.
let arr = [1,2,3,4];
console.log(arr); // 1,2,3,4
arr.length = 0;
console.log(arr); // []
Make one page websites quickly using my Carrd Templates