Imagine you have a randomly arranged array of day strings like:
var days = ['Tues', 'Thur', 'Mon', 'Wed']
where days[0] = 'Tues'
, days[1] = 'Thurs'
, and so on. When you sort this array, it becomes
sortedDays = ['Mon', 'Tues', 'Wed', 'Thur']
But now, the challenge is to associate the indices of the newly-sorted array with those of the original array; for example, the old array has indices as (0, 1, 2, 3) while the new array has indices as (2, 0, 3, 1).
Figuring out how to accomplish this task can be tricky.