Зміст курсу
JavaScript Data Structures
JavaScript Data Structures
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.
- Use a
for
loop to iterate through thefordCarModels
array. - Inside the
for
loop, log each model to the console usingconsole.log()
.
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:
- To create a
for
loop, use the following syntax:for (let i = 0; i < array.length; i += 1) { ... }
. - Use
console.log()
to log each model inside thefor
loop.
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]); }
Дякуємо за ваш відгук!