Having the following array :
var arr = [a,b,c,d,e];
I'm struggling to get a clean function that sorts the array based on a specified index, keeping at the same time the original order
For example, sorting the array from index 3 (so here, from "d"), would give the following :
[d,e,a,b,c]
From index 2 :
[c,d,e,a,b]
etc...
It might be obvious for some but I can't make it in my mind
Help appreciated, thx in advance
* Edit *
Is a duplicate. Here is a good one.