Javascript provide us a push() method by using this method we can add new element in to the array.
Ex:-
var name = ["Amit", "Rohit", "Manoj"]; // existing array with names
name.push("Kapil"); // adding new element
Output:-
name array will looks like :
["Amit", "Rohit", "Manoj","Kapil"]
0 Comment(s)