Wrong code in insertionsort has been taught

mama you have taugh wrong code, in hte statement counter<arr.length-1,(-1)will not be there because of that it is not able to reach the last element in the array