title: In given array I have only 2 zeroes but the i is showing 4. Please explain it for me
body: <p>Given array to be executed here is <code>[0, 1, 0, 3, 12]</code>.</p>
  <pre><code>var moveZeroes = function(nums) {
      for (let i=0; i &lt; nums.length; i++){
          if (nums[i] === 0){
              nums.push(0);
              console.log(nums)
              console.log(i)
              nums.splice(i, 1)
          }
      }
  };
  
  moveZeroes([0, 1, 0, 3, 12]);
  </code></pre>
  <p>Result is</p>
  <pre><code>[0, 1, 0, 3, 12, 0]
  ›0
  ›[1, 0, 3, 12, 0, 0]
  ›1
  ›[1, 3, 12, 0, 0, 0]
  ›3
  ›[1, 3, 12, 0, 0, 0]
  ›4
  ›[1, 3, 12, 0, 0]
  </code></pre>
  <p>I am not understanding how is the code working.</p>