Arrays

In the head of this document is this array:

var colours = new Array ("Red","Green","Blue");


Here's how we can get some values out of it:

colours[0]

colours[2]



And here's how we could change one of the values:

colours[0]='Orange';

After clicking the link above, go back and click "colours[0]" to see it's been changed.




View Source to see JavaScript.

Back to examples