title: Returning customize Array value
body: <p>I have a sample of code that returns each value in an array, in order. I have used <code>forEach()</code>. Is there any way to return value in customize array. </p>
  
  <p>I made some function for split <code>text-area</code> value to all textarea and query using text string. I am able to success. But Some Problem. Below Example.</p>
  
  <ol>
  <li><p>Type to <code>Filed1</code> string like:
    <br> <code>GFSD</code><br><code>65897542</code></p></li>
  <li><p>Then Click Split Button. Output: part all value to reaming text area.</p></li>
  <li><p>Put <strong>GF</strong> value to <strong>Input Character</strong> Filed. Output: <strong>6589</strong></p></li>
  <li>My Question is When i put value like <strong>GF</strong> then output <strong>6589</strong>. And when put <strong>FG</strong> then also same output <strong>6589</strong> instead of <strong>8965</strong>. If any solution Pls help me out. I wish to the Character strictly follow number.</li>
  </ol>
  
  <p>Sample of Code:</p>
  
  <pre><code>$('#output1').focus(()=&gt;{
      var a=document.querySelectorAll('textarea');
      var str = $('#ccMain').val();
      var first = str[0];
      var second = str[1];
      console.log(first," ", second)
      var str='';
      a.forEach(e=&gt;e.value.includes(first)||e.value.includes(second)?str+=e.value.substr(1,e.value.length):false)
          $('#output1').val(str);
      })
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function splitText() {
        var textAreas = [];
        //Put all of the textareas into an array for easy access
        for(let i = 1; i &lt;= 4; i++) {
        textAreas.push(document.getElementById(`value${i}`));
        }
        //Read the text from text1 and split it at a new line
        var text = textAreas[0].value;
        var [line1, line2] = text.split(/\r?\n/)
        for(let i = 0; i &lt; 4; i++) {
        var combinedText = line1.substring(i, i+1) + line2.substring(i*2, (i+1)*2)
        textAreas[i].value = combinedText;
        }
        }
        $('#output').focus(()=&gt;{
        var a=document.querySelectorAll('textarea');
        var str = $('#ccMain').val();
        var first = str[0];
        var second = str[1];
        console.log(first," ", second)
        var str='';
        a.forEach(e=&gt;e.value.includes(first)||e.value.includes(second)?str+=e.value.substr(1,e.value.length):false)
        $('#output').val(str);
        })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
     &lt;head&gt;
        &lt;title&gt;Test Demo&lt;/title&gt;
        &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;label&gt;Filed1 &lt;/label&gt;
        &lt;textarea id="value1"&gt;&lt;/textarea&gt;
       
        &lt;label&gt;Filed2:&lt;/label&gt;
        &lt;textarea id="value2"&gt;&lt;/textarea&gt;
        
        &lt;label&gt;Filed3:&lt;/label&gt;
        &lt;textarea id="value3"&gt;&lt;/textarea&gt;
        
        &lt;label&gt;Filed4:&lt;/label&gt;
        &lt;textarea id="value4"&gt;&lt;/textarea&gt;
        
        &lt;button onclick="splitText()"&gt;Split!&lt;/button&gt;
        &lt;br&gt;
        &lt;label&gt;Input Character:&lt;/label&gt;
        &lt;br&gt;
       
        &lt;input type="text" id="ccMain"  &gt;
       
        &lt;textarea id="output"&gt;&lt;/textarea&gt;
        
     &lt;/body&gt;
     &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>