JavaScript Examples
Arrays
These examples use concepts introduced in the Slide Show examples to explain arrays.
- a counter - using recursion
- stop recursion with a conditional statement
- setTimeout() method
- setTimeout() method and recursion
- automatic slide show
- storing and accessing values in an array
- storing values in an array - at declaration
- using an array in the slide show
- using a variable as the index number of an array
- exploiting an array to simplify script
- clearTimeout() method
- resuming after clearTimeout() method is called
- Math.random() method
- produce a random number between 0 and 5
- produce a random number between 0 and 9
- produce a random number between 1 and 10
- produce a random number between 5 and 10
- display a random image