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']
var a = [];
a.push(1, 2, 3);
console.log(a);
Also in JavaScript:
- fetch data from external url nodejs
- component unmount useeffect
- random number in js
- node js mysql escape string
- operator sum string to character javascript
- nodejs await inside map
- react transition group
- populate modal from table
- json placholder
- react native passing params to nested navigators
- appendchild multiple elements
- javascript boolean regex match
- could not find a declaration file for module in react project
- round off value in javascript
- website login and registartion source code jsp java
- javascript convert string to json object
- javascript get random string
- javascript get age
- javascript code
- javascript array filter
- Javascript get element height and width
- react useLocation()
- javascript object tostring
- javascript this in settimeout