clear javascript array code example
Example 1: javascript empty array
arr = [];
const empty = arr => arr.length = 0;
var arr= [1,2,3,4,5];
empty(arr)
Example 2: javascript clear array
let aray = [1,2,3,4,5,6,7,8,9,10];
array = [];
array.length = 0;
array.splice(0, array.length);
array.map( () => array.pop());
array.map( () => array.shift());
Example 3: js delete all array items
A.splice(0,A.length)
Example 4: javascript array clear
var cars = ["mazda","honda","tesla"];
cars = [];
Example 5: how to clear array in javascript
A.length = 0
Example 6: empty array js
let list = [1, 2, 3, 4];
function empty() {
list = [];
}
empty();