Skip to content
Advertisement

Filter array object by type and compare key

I have two arrays, in one (aux) I get key and value. In the second array of objects (result)

enter image description here

I have the attribute “correlati” and what I’m looking for is that if the key of the array “aux” is equal to the attribute “correlati” then it pushes that result in a new array that looks like the following :

JavaScript

code:

JavaScript

Advertisement

Answer

You can loop through result array and check if array_element["correlative"] exists in aux array as key. So,…

JavaScript

Maybe this is what you wanted

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement