I have 2 arrays:
[6,1,4]
[“apple”,“pear”,“orange”]
how to sort the fruit array base on the first?
If the first array was sorted as ascending order:-
[1,4,6]
the second array follows the first:-
[“pear”,“orange”,“apple”]
if it was sorted as descending order:-
[6,4,1]
the second one follows the first array order
[“apple”,“orange”,“pear”]