title: Trouble removing elements from multidimensional array using for loop (javascript)
body: <p>I'm banging my noob head against the wall on this one...</p>
  
  <p>I have the following code: </p>
  
  <pre><code>var guns2 = 
  [
  ["Model 17", "Glock"],
  ["Model 19", "Glock"],
  ["PPQ", "Walther"],
  ["P2000", "HK"],
  ["Model 92", "Beretta"],
  ["Model 34", "Glock"]
  ]
  
  var gunsMake = function () {
      for (i=0; i&lt;guns2.length; i++){
          var make = guns2[i][1];
              if (make ==="Glock"){
                  }
              else {
                  guns2.splice(i,1);
                  }
          };
      };
  gunsMake();
  console.log(guns2);
  </code></pre>
  
  <p>The result I get in the console is as follows:</p>
  
  <pre><code>[["Model 17", "Glock"], ["Model 19", "Glock"], ["P2000", "HK"], ["Model 34", "Glock"]]
  </code></pre>
  
  <p>What I'd like to see is:</p>
  
  <pre><code>[["Model 17", "Glock"], ["Model 19", "Glock"], ["Model 34", "Glock"]]
  </code></pre>
  
  <p>"["P2000", "HK"]" <em>shouldn't</em> be there...I have a feeling it has something to do with the "guns2.length" argument in the for loop..it seems like it's skipping the subsequent array every time it splices, but I can't quite wrap my brain around a fix.</p>
  
  <p>Please, someone steer me right :)</p>