Answers for "delete all elements from array javascript"

6

Javascript remove empty elements from array

var colors=["red","blue",,null,undefined,,"green"];

//remove null and undefined elements from colors
var realColors = colors.filter(function (e) {return e != null;});
console.log(realColors);
Posted by: Guest on July-25-2019
1

js delete all array items

A.splice(0,A.length)
Posted by: Guest on May-30-2020
3

js delete all array items

A = [];
Posted by: Guest on May-30-2020
1

js delete all from array

var list = [1, 2, 3, 4];
function empty() {
    //empty your array
    list.length = 0;
}
empty();
Posted by: Guest on May-07-2020
0

js delete all array items

A.length = 0
Posted by: Guest on May-30-2020

Code answers related to "delete all elements from array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language