Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Array Element Iteration | Mastering Arrays
JavaScript Data Structures
course content

Зміст курсу

JavaScript Data Structures

JavaScript Data Structures

1. Introduction and Prerequisites
2. Objects Fundamentals
3. Advanced Object Manipulation
4. Mastering Arrays
5. Advanced Array Operations

Challenge: Array Element Iteration

Task

You are given an array of Ford car models. The task is to create a for loop to iterate through the array and log each model.

  1. Use a for loop to iterate through the fordCarModels array.
  2. Inside the for loop, log each model to the console using console.log().
123456
const fordCarModels = ["Mustang", "F-150", "Explorer", "Expedition", "Taurus"]; // Use a `for` loop to iterate and log models for (let ___; i < ___.length; i += 1) { console.log(___); }

Expected Output:

  1. To create a for loop, use the following syntax: for (let i = 0; i < array.length; i += 1) { ... }.
  2. Use console.log() to log each model inside the for loop.
123456
const fordCarModels = ["Mustang", "F-150", "Explorer", "Expedition", "Taurus"]; // Use a `for` loop to iterate and log models for (let i = 0; i < fordCarModels.length; i += 1) { console.log(fordCarModels[i]); }

Все було зрозуміло?

Секція 4. Розділ 6
We're sorry to hear that something went wrong. What happened?
some-alt