insertSort([3,5,67,2,1,111,32,5,6,22,1,89])
function insertSort(data){
if(!Object.prototype.toString.call(data) === '[object Array]' || data.length <2){ return false; } var res =[]; res.push(data[0]) for(var i= 1;i=0&&res[j-1]>res[j]){ var temp = res[j-1]; res[j-1]= res[j]; res[j] = temp; j--; } } console.log(res); }