Answers for "append a new eleemnt to the array"

0

how to append an element to an array in javascript

//Use push() method
//Syntax: 
array_name.push(element);
//Example: 
let fruits = ["Mango", "Apple"];
//We want to append "Orange" to the array so we will use push() method
fruits.push("Orange"); 
//There we go, we have successfully appended "Orange" to fruits array!
Posted by: Guest on April-04-2021

Code answers related to "append a new eleemnt to the array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language