Created
July 30, 2020 14:32
-
-
Save alx8437/a2ec155989529d0e50374434cf6dcce7 to your computer and use it in GitHub Desktop.
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
let arr1 = [ | |
{id: "pduutGbL2-M", isChecked: true}, | |
{id: "J6MJPuJiDPo", isChecked: true} | |
] | |
let arr2 = [ | |
{id: "pduutGbL2-M", isChecked: false}, | |
{id: "J6MJPuJiDPo", isChecked: false}, | |
{id: "WD6jyaFrVM8", isChecked: false}, | |
{id: "ULP07chR5EQ", isChecked: false} | |
] | |
for(const el of arr1) { | |
const index = arr2.findIndex(x => x.id === el.id); | |
arr2[index].isChecked = true; | |
} | |
console.log(arr2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment