Created
March 4, 2020 09:06
-
-
Save nathakits/30ba0896dc0c89fe869565e191e56bb9 to your computer and use it in GitHub Desktop.
Merge 2 array objects
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
const arr1 = [{attributes: "foobar"}] | |
const arr2 = [{html: "foobar"}] | |
const mergedArray = arr1.map((item,i)=>{ | |
//merging two objects | |
return Object.assign({},item,arr2[i]) | |
}) | |
// mergedArray = [{attributes: "foobar", html: "foobar}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment