Skip to content

Instantly share code, notes, and snippets.

@rakibhasansabbir
Created June 25, 2020 08:00
Show Gist options
  • Save rakibhasansabbir/2c838b3bf0ecc48a707aff991dc349bc to your computer and use it in GitHub Desktop.
Save rakibhasansabbir/2c838b3bf0ecc48a707aff991dc349bc to your computer and use it in GitHub Desktop.
Adding array to another array example for javascript
const array1 = [1, 2, 3, 4, 5]
const array2 = [6, 7, 8, 9, 10]
// to add after
const newArray = [...array1, ...array2]
// to add before
const newArray = [...array2, ...array1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment