title: Run the same function on each item in a list / array
body: <h1>Goal</h1>
  
  <p>I have <a href="http://jsfiddle.net/vpbw44nj/" rel="nofollow noreferrer"><strong>a working function</strong> (JSFiddle)</a>. On numerous occasions throughout a script the function runs sequentially. In these instances, there is a lot of repetitious code that I would like to consolidate.</p>
  
  <p>Ideally changing code like this:</p>
  
  <pre><code>functionName("First_item") + 
  functionName("Second_item") + 
  functionName("Third_item") + 
  </code></pre>
  
  <p>To something like this:</p>
  
  <pre><code>functionName("First_item", "Second_item", "Third_item");
  </code></pre>
  
  <p>The function will run for each item in the list so the result is the same but the code more elegant and maintainable.</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>I’m not looking to use any libraries (e.g. jQuery) to accomplish the goal.</li>
  </ul>
  
  <h1>Solution</h1>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/a/27107622/3551393">Amit Joki’s answer</a> kindly noted I could use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments" rel="nofollow noreferrer">arguments</a>. When I implemented the code, <a href="http://jsfiddle.net/2qxzbasj/" rel="nofollow noreferrer"><strong>the modified function</strong> (JSFiddle)</a> only returned the <code>output</code> string for the first argument / item.</p></li>
  <li><p><a href="https://stackoverflow.com/a/27107684/3551393">Vanice’s answer</a> pointed out the eventual solution. </p>
  
  <ul>
  <li>Make one string from the output of all arguments / items by concatenating (joining) the <code>output</code> strings within the for loop (with the use of <code>+=</code>).</li>
  <li>Return the concatenated output by placing the <code>return</code> outside of the for loop.</li>
  </ul></li>
  </ol>
  
  <h1>Example</h1>
  
  <p><a href="http://jsfiddle.net/rvshp89g/" rel="nofollow noreferrer">Working solution (JSFiddle)</a>.</p>
  
  <hr>
  
  <h1>Thanks</h1>
  
  <p>Thank you very much to everyone for their time and help on this. I really appreciate it!</p>