title: Is it possible to pass an array from onClick to javascript function?
body: <p>In PHP I can write a function like this:</p>
  
  <pre><code>function myFunction(myArray)
  {
      foreach(myArray)
      {
          // do stuff with array
      }
  }
  </code></pre>
  
  <p>Then I can call it like this (maybe ugly, but still works):</p>
  
  <pre><code>myFunction(array("string1","string2"));
  </code></pre>
  
  <p>I want to do something similar with JavaScript but can't figure out if it's possible to pass arrays to functions like that. This is my psuedo-function:</p>
  
  <pre><code>function myFunction(myArray)
  {
      for (index = 0; index &lt; myArray.length; ++index)
      {
          // do stuff with array
      }
  }
  </code></pre>
  
  <p>I want to call it from a button using onClick like this:</p>
  
  <pre><code>&lt;input type="button" value="myButton" onClick="return myFunction(array("string1","string2"))"&gt;
  </code></pre>
  
  <p>Can this be accomplished in a simle way?</p>