JavaScript/Arrays/Exercises

Topic: Arrays

1. What is the output of the following script?

2. Add elements
 * Create an array with all odd numbers that are smaller than 10.
 * Show the array with the  command.
 * Show how many elements the array contains.
 * Add 2, 4, 6, 8 to the end of the array and show it again.
 * Insert the value 20 on the 20th array element and show the array again.

3. Remove elements
 * Create an array with all numbers from 1 to 6.
 * Show the array with the  command.
 * Delete the first and last element and show the resulting array.

4. Combine elements
 * Create an empty array.
 * Add 0, 1, 2 to the array with the  method and show the array.
 * Create the string "0 + 1 + 2" out of the array using the  method and show the string.