Skip to content

Instantly share code, notes, and snippets.

@liuxd
Created December 4, 2018 21:38
Show Gist options
  • Select an option

  • Save liuxd/1b210f6007e3e965ff4e7dbbc11fdabf to your computer and use it in GitHub Desktop.

Select an option

Save liuxd/1b210f6007e3e965ff4e7dbbc11fdabf to your computer and use it in GitHub Desktop.
[array_merge() in JS]
// for array
let arr1 = ['a', 'b'], arr2 = ['c'];
console.log(arr1.concat(arr2)); // ['a', 'b', 'c']
// for object
let obj1 = {'a': 1, 'b': 2}, obj2= {'c': 3, 'a': 4}
console.log(Object.assign(obj1, obj2)) // {a: 4, b: 2, c: 3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment