Challenge: Loop Through Arrays with for
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()
.
123456const 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:
Mustang
F-150
Explorer
Expedition
Taurus
- 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.
123456const 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]); }
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 4. Capítulo 6
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Awesome!
Completion rate improved to 2.27
Challenge: Loop Through Arrays with for
Desliza para mostrar el menú
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()
.
123456const 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:
Mustang
F-150
Explorer
Expedition
Taurus
- 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.
123456const 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]); }
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 4. Capítulo 6