Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let key = 'id';
- let arr1 = [
- { id: "9762 /3/a/z/group( + ) / ()/", date: "2017-01-24" },
- { id: "abdc4051", date: "2017-01-22" }
- ];
- let arr2 = [
- { id: "9762 /3/a/z/group( + ) / ()/", match:true},
- { id: "abdc4051", match: true}
- ];
- arr1.forEach((x,y)=> {
- let a = arr2.find(d => x[key] == d[key]);
- if(a && (a[key] == x[key])) arr1[y] = { ...arr1[y], ...a }
- })
- //
- console.log(arr1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement