title: removing empty rows from an array in javascript
body: <p>I have an array with empty rows,I have the field "codeOperation" to test if a row is empty or not,this is my table:</p>
  
  <p><a href="https://i.stack.imgur.com/WwI7J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WwI7J.png" alt="enter image description here"></a></p>
  
  <p>The client should fill the table whith data and left the rest of rows empty, what I want is when the client click on the "ADD" boutton only the data will be send and the emoty rows will be deleted.</p>
  
  <p>this is my code:</p>
  
  <pre><code>//function to send the Data
  $scope.updateGamme= function(gamme) {
  
      gamme.listElementGammeOf = $scope.finalOperationsList;
  
      $scope.DeleteEmptyRows(gamme.listElementGammeOf);
  
               $http
                   .put(
                       baseUrl +
                       "/gamme/update",
                       gamme)
                   .success(
                       function(gammeModifiee) {
                           //send the Data and update 
                              .....     
                       }); }
  
  //delete the empty rows
  $scope.DeleteEmptyRows = function(listelements){
              for (var i = 0; i &lt; listelements.length; i++) {
                  if (listelements[i].operationCode == "")
                      listelements.splice(i, 1);
              }
  </code></pre>
  
  <p>What I get as a result with this code, is that per example I get 5 items, my code will remove the rows 3 and 4 the row 2 is not deleted</p>
  
  <p>Is there any problem with my code? Please help me find it.</p>
  
  <p>Thanks for help</p>