Skip to content
Advertisement

Sort array based on values in another array

I have 2 arrays as follows.

Array 1

JavaScript

And the next array

Array 2

JavaScript

I want to sort the array1 according to the data order in array2. I have tried something like this but it’s giving me a undefined result

JavaScript

Can someone help me with this?

Advertisement

Answer

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