I have two arrays:
Original Array:
[{id:1, name:'A'},{id:2, name:'B'},{id:3, name:'C'},{id:4, name:'D'},{id:5, name:'E'}]
There is one more array:
New Array:
[{id:3, name:'C'},{id:5, name:'E'},{id:2, name:'B'}]
I want the new array to be sorted based on the id of the original array, so that the resolt is as follows:
Sorted New Array
[{id:2, name:'B'},{id:3, name:'C'},{id:5, name:'E'}]
Can you please guide me on how how can do this sorting?I just don't know where to start?