I have the following problem, which I struggle to solve:
I have an array of objects, all of them have same properties but different values. I receive the value of property two and based on it to find the value of property one.
What I tried as approach is the following:
- make copy of the array
- compare if the value match
- take the other value if it matches
But this seems quite ugly as solution.
Any other ideas?
const array = [{
one: 3,
two: "some value"
}, {
one: 7,
two: "some other value"
}]