Hi, I'm a developer with three year of experience. I am trained in Java/J2e but I am mostly a Javascript/Typescript lover <3 currently working in GIS, with ReactJS and LeafletJS
Thanks for your reply.
Could you details more the process you use? Why would you use findIndex?
I tried to use your method in my use case, but it doesn't remove all the values from the smaller list in the total one
I will edit my post to make it more clearer with the expected result
Hi, I'm a developer with three year of experience. I am trained in Java/J2e but I am mostly a Javascript/Typescript lover <3 currently working in GIS, with ReactJS and LeafletJS
Doesn't findIndex returns the first value that match the provided testing function? In need all the elements that match the predicate, not only the first one.
a more concise way would be to use the new ES6 spread operator and Set
merge your 2 arrays then
let mergedArray = array1.concat(array2)
const unique = [...new Set(mergedArray.map(item => item.label))];
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for your reply.
Could you details more the process you use? Why would you use findIndex?
I tried to use your method in my use case, but it doesn't remove all the values from the smaller list in the total one
I will edit my post to make it more clearer with the expected result
I have used findindex to find current index property value to match with passed property to make it unique
Doesn't findIndex returns the first value that match the provided testing function? In need all the elements that match the predicate, not only the first one.
a more concise way would be to use the new ES6 spread operator and Set
merge your 2 arrays then
let mergedArray = array1.concat(array2)
const unique = [...new Set(mergedArray.map(item => item.label))];