Using Javascript, I want to sort an array of integer, but instead of starting at 0, I would like to be able to specify the first item in the array. For example, using this array as a starting point:
var array = [4, 0, 1, 2, 5, 8, 7, 3, 6];
If I want to re-order but start at 3, with the end result:
var array = [3, 4, 5, 6, 7, 8, 0, 1, 2];
Start at 8 would look like this:
var array = [8, 0, 1, 2, 3, 4, 5, 6, 7];
Start at 0 would look like this (default sort):
var array = [0, 1, 2, 3, 4, 5, 6, 7, 8];
Any idea how I can do this? Thanks.
2is up front?