Consider the array
let myArray = [0,1,2,3,4,5,6,7]
I want to sort it this way
let reversedPairs = [myArray[6],myArray[7],myArray[4],myArray[5],myArray[2],myArray[3],myArray[0],myArray[1]]
// RESULT [6,7,4,5,2,3,0,1]
How can I achieve the RESULT without having to go through the array like in reversePairs? I'm interested in sorting them by their indexes and not their values.
Thank you.