title: How to remove specific part of string from each item of array using javascript?
body: <p>Given the following:</p>
  
  <pre><code>var arr = [
      "one,two,three",
      "four,five,six,seven",
      "eight,nine,ten",
      "11,12,13,14"
  ];
  </code></pre>
  
  <p>What's the best way to remove the second word from each element in the array? The desired output of the array would be:</p>
  
  <pre><code>arr = [
      "one,three",
      "four,six,seven",
      "eight,ten",
      "11,13,14"
  ];
  </code></pre>
  
  <p>I felt the most logical approach would be to use a for loop to cycle through the array and remove index 1 from each element, like as follows:</p>
  
  <pre><code>for(var i=0; i &lt; arr.length; i++) {
      i.splice(1,1).join(';');
  }
  </code></pre>
  
  <p>(within the loop, I also tried <code>arr[i].splice(1,1).join(';');</code>) --- but neither approach is returning the desired outcome. What am I doing wrong and what's the most efficient way to do this?</p>