javascript push at end code example

Example 1: js array add element

array.push(element)

Example 2: js add item to array

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");

Example 3: add item to list javascript

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi"); // Fruits = ["Banana", "Orange", "Apple", "Mango", "Kiwi"];

Example 4: javascript array add end

// example:
let yourArray = [1, 2, 3];
yourArray.push(4); // yourArray = [1, 2, 3, 4]

// syntax:
// .push();

Tags:

Misc Example