is it possible to sort an array and just get the return of the placements NOT change the order

  arrays, javascript, jquery, sorting

I have an array of numbers

counter[7,3,9,5,1]

if i do counter.sort() it will change the array to

counter[1,3,5,7,9]

is it possible to sort an array and just get the return of the placements NOT CHANGE THE ORDER
something like this

sortedArrayByPlacment[3,1,4,2,0];

Source: Ask Javascript Questions

One Reply to “is it possible to sort an array and just get the return of the placements NOT change the order”

LEAVE A COMMENT