Answers for "JavaScript Array push()"

35

push array javascript

let array = ["A", "B"];
let variable = "what you want to add";

//Add the variable to the end of the array
array.push(variable);

//===========================
console.log(array);
//output =>
//["A", "B", "what you want to add"]
Posted by: Guest on April-26-2020
1

JavaScript Array push()

const fruits = ["Banana", "Orange", "Apple", "Mango"];

fruits.push("Kiwi");   // Adds "Kiwi"
Posted by: Guest on July-16-2021

Code answers related to "JavaScript Array push()"

Browse Popular Code Answers by Language