title: Split and reformat strings from array, check if string starts with certain characters, add missing characters, map result to new arrays
body: <p>I have an array of usernames + IDs (IDs start with an <code>&lt;@</code>),  that I'd like to perform multiple operations on in the same function.</p>
  <p>Namely:</p>
  <ol>
  <li><p>Split the strings based on the &quot;|&quot; separator.</p>
  </li>
  <li><p>check if each string starts and ends with <code>&lt;</code> and <code>&gt;</code> respectively. If not, we will add these back to the string (to restore any missing from a split.)</p>
  </li>
  <li><p>Output the results to two different arrays, <code>usernames</code> and <code>userIDs</code></p>
  </li>
  </ol>
  <p>I have the split part working fine, e.g. our current output from the below would be:</p>
  <pre><code>&lt;@u01d01m666e,banana050&gt;,&lt;@u01bgh5hads,apple060&gt;
  </code></pre>
  <p>as <code>String.startswith()</code> is unavailable for Arrays, what's the best method to approach this? Should each operation be a separate function, or is it feasible to complete all tasks under one function?</p>
  <p>The desired output in this case would be:</p>
  <p>a return value of two arrays:</p>
  <p>Array #1 contains the UserIDs, in this case:</p>
  <pre><code>&lt;@u01d01m666e&gt;,&lt;@u01bgh5hads&gt;,
  </code></pre>
  <p>Array #2 contains the usernames, in this case:</p>
  <pre><code>&lt;banana050&gt;,&lt;apple060&gt;
  </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>var usernames = ['&lt;@u01d01m666e|banana050&gt;', '&lt;@u01bgh5hads|apple060&gt;'];
  
  var userIDs = usernames.map(function mapper(value, index, array) {
    if (typeof value == "string") {
      return value.split("|");
  
    } else {
      return value.map(mapper);
      console.log("The array mapper was given an incorrect input (not a string.)");
    }
  });
  
  document.getElementById("demo").innerHTML = userIDs;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
    &lt;h1 id="demo"&gt;&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>