javascript add multiple items to array
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']
var a = [];
a.push(1, 2, 3);
console.log(a);
Also in JavaScript:
- js get timezone name
- canvas set background color
- how to make a div sticky using js
- js destructuring explained
- compare string length javascript
- find duplicate values in array javascript
- how to make a css clock
- javascript get string from array with space between
- postman test for true
- angular detect router change
- list of dictionaries to json python
- base64 decode javascript
- jquery example sheetjs
- js hash table example
- compare date and time in js
- javascript get day of year from date
- enable swipe using javascript
- how to select a class and then change the children of that class with javascript
- node.js 8 has been deprecated. firebase functions
- how to convert whole strig in lowercase in js
- count word and space in text javascript
- mock sqs.sendMessage node js
- property 'auth' does not exist on type 'angularfireauth' angular
- chart.js line chart animation on canvas update react class state