Sorting array and inserting value at specific location

Sorting array and inserting value at specific location

Hi, I have an array of 8 values all containing different numbers,


I want to be able to insert the value of the array at the zero index into its proper chronological order. However the way I am trying this leaves me with zeros at the start.

I have explained what I am looking for in the comments within the code.

Thanks in advance.

PS, I have quickly put the example in Javascript but JQuery would be preferable.