Created
March 11, 2017 11:29
-
-
Save jamilservicos/3b84498c92cd8e1fa0f9b335770dc24b to your computer and use it in GitHub Desktop.
update array from other array
This file contains 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 data = {}; | |
data.final = [ | |
{ "id": 0, "name": "Fleming James" }, | |
{ "id": 1, "name": "Everett Johnson" }, | |
{ "id": 2, "name": "Brock Owens" } | |
]; | |
data.update = [ | |
{ "id": 0, "name": "Catherine Cooley" }, | |
{ "id": 1, "name": "Mavis Grant" }, | |
{ "id": 2, "name": "Brock Owens" } | |
]; | |
for (let i = 0; i < Object.keys(data.update).length; i++) { | |
data.final[Object.keys(data.update)[i]] = data.update[Object.keys(data.update)[i]]; | |
} | |
console.log(data.final); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment