title: Splitting An Array Value In a ForEach Loop With JavaScript?
body: <p>I am trying to do a forEach loop and take each item and split it at a character. In this case I want to split the array item text at "||". What I currently have is:</p>
  
  <pre><code>var array = [
    [
      "featured", ["feat||1", "feat||2", "feat||3"]
    ],
    [
      "new", ["new||1", "new||2", "new||3"]
    ]
  ];
  
  var taxIDs = [];
  
  
  array.forEach((i) =&gt; {
    if (i[1].length) {
      taxIDs.push(i[1].split("||")[1]);
    }
  });
  </code></pre>
  
  <p>So I was trying to take i[1] and splitting it at "||" and getting the second item in that split array, but doing this throws and error and not sure the best approach to accomplish what I need?</p>
  
  <p>EDIT (this is what I see when console logging my array:</p>
  
  <pre><code>(3) [Array(2), Array(2)]
   0: (2) ["featured", Array(3)]
     0: "featured"
     1: (3) ["feat||1", "feat||2", "feat||3"]
   1: (2) ["news", Array(2)]
     0: "news"
     1: (2) ["news||1", "news||2", "news||3"]
  </code></pre>
  
  <p>So there are 3 levels of arrays in this array.</p>