title: How to remove number from array based on arguments
body: <p>I have two arrays like this:</p>
  
  <pre><code>var arr = ["1", "3" , "4"];
  var arr2 = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
  </code></pre>
  
  <p>I want to remove numbers from second array based on numbers that are available in first array.</p>
  
  <p>I tried this but I am getting wrong values such as 2,4,6,8:</p>
  
  <pre><code>theButton.onclick = function removePassedInNumbers(arr){
      for(var i = 0; i &lt; arr2.length; i++){
      if(arr2.indexOf(arr[i])){
          arr2.splice(i, 1);
      }
    }
      document.getElementById('myNumber').innerHTML = arr2;
  }
  
  &lt;input type="button" id="theButton" onclick="removePassedInNumbers(arr)" value="Click here"/&gt;
  &lt;p id="myNumber"&gt;hey&lt;/p&gt;
  </code></pre>
  
  <p>Here is the fiddle: <a href="https://jsfiddle.net/4hLcanc6/" rel="nofollow">https://jsfiddle.net/4hLcanc6/</a></p>
  
  <p>Where did I go wrong?</p>