How to pass an array to a function in JavaScript

 
This example shows that how to pass an array to a function in javaScript :

<HTML>
   <HEAD>
   <TITLE>
   Iteration Two
   </TITLE>
   <SCRIPT>
      function showArrayOfCities(tempArray)
       {
         var quote = "";
         for (var i = 0; i < tempArray.length; i++)
           {
             quote += tempArray[i]+"</br>";
           }
         return quote;    
       }
   </SCRIPT>
   </HEAD>
   <BODY>
   <SCRIPT>
       var ArrayCity = new Array(4);
         ArrayCity[0] = "New Delhi";
         ArrayCity[1] = "NewYork";
         ArrayCity[2] = "London";
         ArrayCity[3] = "Kolkata";        
       document.write(showArrayOfCities(ArrayCity));
   </SCRIPT>
   </BODY>
</HTML>