add to empty array javascript code example
Example 1: javascript empty array
var colors = ["red","blue","green"];
colors = []; //empty the array
Example 2: js add element to array
var fruits = [ "Orange", "Apple", "Mango"];
fruits.push("Banana");
Example 3: create empty array javascript
const myArray1 = []
// or...
const myArray2 = new Array()
Example 4: add val to array jquery
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");