Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn

Great work. Now, what if we want to select one item from an array?

Luckily, each item in an array has a numbered position. We can access an item using its number, just like we would in an ordinary list. There’s one catch though!

JavaScript counts starting from 0, not 1, so the first item in an array will be at position 0. This is because JavaScript is zero-indexed.

We can select the first item in an array like this:

var bucketList = ['Rappel into a cave', 'Take a falconry class', 'Learn to juggle']; var listItem = bucketList[0]; console.log(listItem); // Output: 'Rappel into a cave'

If we wanted the second item, we'd write:

var bucketList = ['Rappel into a cave', 'Take a falconry class', 'Learn to juggle']; var listItem = bucketList[1]; console.log(listItem); // Output: 'Take a falconry class'
Report a Bug
If you see a bug or any other issue with this page, please report it here.