Algorithms: Implement Insertion Sort help

Hello campers
I have passed the challenge ,but I still have some issues in my code

function insertionSort(array) {
  // change code below this line
  let item;
    for(let i=0;i<array.length;i++){ 
      if(array[i+1]<array[i]){ 
        item=array[i+1];
        array.splice(i+1,1);
        array.splice(i,0,item);
        i=0;
      }     
    }
  // change code above this line
return console.log(array);
}
insertionSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92])

for example FCC array will be sorted
but this one no
[30,20,1, 4, 2, 8, 345, 123, 43] // the output is [20, 1, 2, 4, 8, 30, 43, 123, 345]
please what is wrong in my code

Honestly, you just got lucky that the array the test used worked with your code. You are not using an insertion sort at all. Test an array which is in reverse order and you might get a better idea of what is going on. For example, using the following array:

[30, 20, 10, 9, 8, 7, 6, 5, 4])

produces:

[ 20, 4, 5, 6, 7, 8, 9, 10, 30 ]
function insertionSort(array) {

  // change code below this line

  console.log(array)

  var jar = 0

  function swap(i,j){

    var temp = array[i]

    array[i] = array[j]

    array[j] = temp

    console.log(array[i],array[j],"are swapped")

    console.log(array)

  }

  for( var i=1;i<array.length;i++){

    jar = i

    recursion(i-1)

    function recursion(j){

      if(array[j]<array[i] || j < 0){

        console.log(array[j],array[i],'yess ')

      }

      else{

        recursion(j-1)

        swap(i,j)

      }

    }

  } 

  console.log(array)

  return array;

  // change code above this line

}

insertionSort([1, 4, 2, 8, 345, 123, 43, 32, 5643, 63, 123, 43, 2, 55, 1, 234, 92]);