You are viewing a single comment's thread. Return to all comments →
Hey, converted your answer to JS, but it will only pass first 2 test, thought?
for (var i = 1; i < array.length; i++) { var j = i; var value = array[i]; while (j >= 1 && (array[j-1] > value)) { array[j] = array[j-1]; j--; } array[j] = value; console.log(array.join(' ')); }
Seems like cookies are disabled on this browser, please enable them to open this website
Insertion Sort - Part 2
You are viewing a single comment's thread. Return to all comments →
Hey, converted your answer to JS, but it will only pass first 2 test, thought?