title: Can I use a loop to execute the same function call multiple times on incrementing element Id's?
body: <p>Right now I have 2 functions called <code>showElement(elementId)</code> and <code>hideElement(elementId)</code>. I use these to hide and display rows in a table based on what a user clicks.</p>
  
  <p>I have a submit button for an area that takes in about 30 rows and looks like the following</p>
  
  <pre><code>function hideGeneralSection {
    hideElement('gen1');
    hideElement('gen2');
    hideElement('gen3');
    hideElement('gen4');
    ...
    hideElement('gen35');
  }
  </code></pre>
  
  <p>I was content with keeping it like this but then I realized I wanted to add in about 5 sections, each with show and hide for all the rows AND I made two new functions that gray out elements / enable them.</p>
  
  <p>In java for example you can print a string with something that looks like the following: <code>("showElement('gen%i')",5)</code>. Is there anything like that in javascript so that I could just make a loop that spits out <code>showElement('genINTEGER')</code> in 3 lines instead of 30 something each time?</p>