array1 is an array of objects, so something like this:
0: {Group: 1, names: "Lastname1, Firstname1", id: 20000001}
1: {Group: 2, names: "Lastname2, Firstname2", id: 20000002}
2: {Group: 3, names: "Lastname3, Firstname3", id: 20000003}
array2 also an array of objects, so something like this:
0: {id: "20000001", photo: ""}
1: {id: "20000001", photo: "/9j/4AAQSkZJRgABAQAAAQABAAD/4QB6RXhpZgAASUkqAAgAAA…9a1EtFKAnd09f/rVlwfdFbVw7LPIoOAGNYwjc/SIaxR//2Q=="}
2: {id: "20000002", photo: ""}
3: {id: "20000003", photo: ""}
4: {id: "20000004", photo: ""}
I want to get the photo value for a specific id based on array1. My array2 can have duplicate values of id, so I want to ignore the one with the empty string.
so at the end of the day, i want to return something like
var image='/9j/4AAQSkZJRgABAQAAAQABAAD/4QB6R...'