JavaScript Fundamentals · Arrays · Lesson 16 of 48
Creating and Accessing Arrays
Concept
Creating and Accessing Arrays
Arrays store ordered lists of values, accessed by a zero-based index.
Because indexing starts at 0, the last item in an array sits at index length - 1, not at index length — a classic off-by-one spot to double check.
- Explain the core idea behind Creating and Accessing Arrays.
- Predict output before running a change.
- Test one realistic and one unusual input.
- Use the result to make the next decision.
- 1. Read one concept.
- 2. Change the example.
- 3. Run, compare, and explain.
- 4. Complete the challenge below.
Self-check before continuing
Without looking at the example, describe what changes when you modify one input in Creating and Accessing Arrays. Then reopen the editor and prove your explanation with a small test.
You are ready to continue when you can predict, test, and explain the result.
Your turn
Create an array of 5 numbers and log the last one using its index.
Ask about this lesson or your next move. The guide explains the path without taking the work away from you.
Ready for the next lesson?
Mark this lesson complete when you have finished the exercise.
Console