Access an array element
In this exercise, we will learn how to access elements of an array by their position within the array. To get a specific element, we call
array[index]. Index stands for the index position of an array-element. Arrays are zero-indexed. This means that we start counting at 0 instead of 1 – the 1st element has index 0, the 2nd has index 1 an so on. In the code below we try the access the first element of the array. But, we introduced a slight mistake. Fix the mistake and run the code.
Get a premium membership to access this content: