Using Functions to Iterate Through an Array
<HTML> <HEAD> <TITLE>Iteration Two</TITLE> <SCRIPT> function makeArray() { var myArray = new Array(4); myArray[0] = "L"; myArray[1] = "l"; myArray[2] = "a"; myArray[3] = "p"; return myArray; } function showArray(theArray){ var quote = ""; for (var i = 0; i < theArray.length; i++){ quote += theArray[i] + " "; } return quote; } </SCRIPT> </HEAD> <BODY> <H1> <SCRIPT> var x = makeArray(); document.write(showArray(x)); </SCRIPT> </H1> </BODY> </HTML>