javascript add multiple list items code example
Example 1: how to add multiple elements to A new array javascript
let vegetables = ['parsnip', 'potato']
let moreVegs = ['celery', 'beetroot']
// Merge the second array into the first one
// Equivalent to vegetables.push('celery', 'beetroot')
Array.prototype.push.apply(vegetables, moreVegs)
console.log(vegetables) // ['parsnip', 'potato', 'celery', 'beetroot']
Example 2: javascript add multiple items to array
var a = [];
a.push(1, 2, 3);
console.log(a);