Answers for "8.3.1. Common Array Methods // push Examples"

0

8.3.1. Common Array Methods // push Examples

//The general syntax for this method is:
arrayName.push(item1, item2, ...)
               
/*This method adds one or more items to the END of an array and returns
the new length.*/

//The new items may be of any data type.

let arr = ['a', 'b', 'c'];

console.log(arr.push('d', 'f', 42));

console.log(arr);

//6
//['a', 'b', 'c', 'd', 'f', 42]
Posted by: Guest on June-14-2021

Code answers related to "8.3.1. Common Array Methods // push Examples"

Code answers related to "Javascript"

Browse Popular Code Answers by Language