delete all elements from array javascript code example
Example 1: remove first element from array javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
Example 2: 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);
Example 3: js delete all array items
A.splice(0,A.length)