Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Created January 11, 2019 09:05
Show Gist options
  • Save 6ui11em/095527b16050aa73e3a2a74bf00e7b7a to your computer and use it in GitHub Desktop.
Save 6ui11em/095527b16050aa73e3a2a74bf00e7b7a to your computer and use it in GitHub Desktop.
Javascript merge arrays #javascript #js #array #merge
var sandwiches1 = ['turkey', 'tuna', 'blt'];
var sandwiches2 = ['chicken', 'pb&j', 'tuna'];
var allSandwiches = sandwiches1.concat(sandwiches2);
// sandwiches1: ['turkey', 'tuna', 'blt']
// sandwiches2: ['chicken', 'pb&j', 'tuna']
// allSandwiches: ['turkey', 'tuna', 'blt', 'chicken', 'pb&j', 'tuna']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment