Doubt in iteration in Bubble Sort

In the second loop i.e., j loop we are writing ’ j<= n-2-i’ but if we use ‘j<=n-i’ or ‘j< n-i’ , I get the sorted array. Can you please explain this it is very confusing .