javascript extend array
The .push method can take multiple arguments. You can use the spread operator to pass all the elements of the second array as arguments to .push:
>>> a.push(...b)
If your browser does not support ECMAScript 6, you can use .apply instead:
>>> a.push.apply(a, b)
Or perhaps, if you think it's clearer:
>>> Array.prototype.push.apply(a,b)
Also in JavaScript:
- bootstrap 4 form validator with jquery
- how to place text at custom position on canvas in javascript
- Iterate with JavaScript Do...While Loops
- javascript substring vs substr
- jquery add attribute
- npm start react
- lodash filter object keys
- month name array javascript
- javascript scroll to top of page
- javascript class inheritance
- fs writefile node
- express js params
- Material-ui add circle icon
- print name time times in javascript
- defer accessing a variable until available in js
- div background image chnage uisng js
- pasword protected page in javascript
- javascript execute function by string name
- change root color js
- bodyparser express
- get name jquery
- how to install all needed modules in node
- disable input field from jquery
- remove etag express