var arr = ["A","B","C"];
//Appending New Value to the defined array
//Printing the Array in Console
You can also append multiple values using this method.
//Appending Multiple values to an Array
firstArray.concat(secondArray) method is used in this case.
//Defining the First Array
arr1 = ["A","B","C"];
//Defining the Second Array
arr2 = ["D","E","F"];
//Appending Second Array To First (Concatenation)
//Printing the Concatenated Array in Console
Appending Values At The Start of Array (Prepending)
//A Defined Array
arr = ["B","C","D"];
//Adding A New Value At the Start of Array
//The New Array Output
arr[arr.length] = newValue;
a = ["A","B","C"];
a[a.length] = "D";
Two arrays can also be appended or concatenated using Array.prototype.push.apply method.
arr1 = [1,2,3];
arr2 = [4,5,6];
We'll send you our First Email within a few seconds! Check your Inbox within a minute.