stuck on a JavaScript homework...created the array but I can't use them in the code...
Instruction:Your code will use an array to store the names of 5 colors: "green", "blue", "yellow", "orange", and "red". The code will prompt the user 4 times for a number between 0 and 4. If the user enters 0, the text color should change to "green", 1 to "blue", etc. If the user enters something that is not a number or not a number between 0 and 4, you should change the background to black.
here is what I got:
<title>Changing Font Color</title>

<body bgcolor="white">
<h1 id="colors">
The color is black.

<script type="text/javascript">
// <Peter Wen> <41752122> comment must be here.

// This function will change the color of the text to the name of the color you give it.
for (i=0; i < 4; i++)
var colorText = window.prompt ("Enter a number from 0 to 4: ");
function changeColor(colorText)
{ var text = document.getElementById("colors[i]");
text.innerHTML = "<font color=\""+colorText+"\">The color is "+colorText+".</font>";

// Declare, create, and put values into your color array here
var colors = new Array (5);
colors[0] = "green";
colors[1] = "blue";
colors[2] = "yellow";
colors[3] = "orange";
colors[4] = "blue";
// Create a loop that runs 4 times.
// Each time it asks the user for a number between 0 and 4.
// If an invalid input is entered, the color displayed should be black.
// Otherwise display the color at that index in the array.