Courses/JavaScript Programming/Arrays - Working with Lists

Arrays - Working with Lists

Store multiple values in arrays

Beginner⏱️ 15 minutes

Lesson Content

JavaScript Arrays

Arrays store multiple values in a single variable.

Creating Arrays:

const fruits = ["apple", "banana", "orange"];
const numbers = [1, 2, 3, 4, 5];

Array Methods:

fruits.push("grape");        // Add to end
fruits.pop();                // Remove from end
fruits.length;               // Get length
fruits[0];                   // Access first item

Looping Arrays:

fruits.forEach(fruit => {
  console.log(fruit);
});

Task: Create an array of 3 programming languages, add one more, then log each one.

javascript
Loading...
Expected Output: HTML
Previous
Functions - Creating Reusable Code
Next (Complete this lesson first)
Objects - Structured Data