empty array shor code example
Example 1: empty array js
let list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
Example 2: empty array javascript
// set array
arr = [1,2,4];
// empty array
arr = [];
let list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
// set array
arr = [1,2,4];
// empty array
arr = [];