title: javascript: pass an array to a function
body: <p>here is my javascript code:</p>
  
  <pre><code>var my_array = new Array();
  my_array[0] = "a";
  my_array[0] = "b";
  my_array[0] = "c";
  
  print_array(my_array);
  
  function print_array(arr)
  {
     alert(arr);
  }
  </code></pre>
  
  <p>But it doesn't work, because I can't pass the array to the function. So, how can I pass an entire array to javascript function?</p>
  
  <p><strong>EDIT:</strong>
  Nevermind. I found the solution.<br>
  Hidden cause this is bad practice and passes the array as a string: </p>
  
  <blockquote class="spoiler">
    <p>  If someone will need to pass an array to the function, first use this: JSON.stringify() and javascript will be able to parse an array.</p>
  </blockquote>