title: How to pass Array/Values to a Javascript function
body: <p>I am learning Javascript for a project using online resources however i don't know how to get this function working. </p>
  
  <pre><code>var results =[[a1,a2,a3,a4,a5]];
  var winner = 0;
  
  function checkWinner (results)
  { 
    for (var i = 0; i &lt; results.length; i++)
      if (results[0][i] &gt; 50)
      {
        winner = results[0][i];
  
      }
  }
  </code></pre>
  
  <p>Just after the function, i use:
      checkWinner(results);</p>
  
  <p>In a HTML file i use alert to display the variable winner. But it obviously doesn't work. I realise it is a problem with my understanding of scope and global variables. </p>