Created
December 4, 2018 21:38
-
-
Save liuxd/1b210f6007e3e965ff4e7dbbc11fdabf to your computer and use it in GitHub Desktop.
[array_merge() in JS]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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