I need to sort one array same as other array like in this example.
Input :
2 1 5 4 9 3 6 7 10 8
A B C D E F G H I J
Output :
1 2 3 4 5 6 7 8 9 10
B A F D C G H J E I
Here is code in c++ but I don't know c++ so if someone can write it in js I would be very greatful https://www.geeksforgeeks.org/sorting-array-according-another-array-using-pair-stl/