0

// Insertion Sort with Loop
var array = [ 2, 4, 6, 8, 0, 5, 2, 5, 7, 8, 4, 7, 9 ];
var solution = [ 0, 2, 2, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9 ];
// start looping at the second item in the array
for(var i = 1; i < array.length; ++i)
{
var key = array[i];
// loop thru the earlier items
//...