Ways of Creating and Accessing an Array
There are several different ways to create arrays in JavaScript. The most common way is to use the Array()
constructor.
const myArray = new Array();
This will create an empty array. You can also create an array with initial values by passing them to the Array()
constructor.
This will create an array with the values 1, 2, 3, and 4 and output the first and last elements of the array to the console.
Task
Edit the above code to have an array with elements from 0 to 9, and print all the elements. Run the above code and experiment with the code to get used to it.