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
forloop to iterate through thefordCarModelsarray. - Inside the
forloop, 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
forloop, use the following syntax:for (let i = 0; i < array.length; i += 1) { ... }. - Use
console.log()to log each model inside theforloop.
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]); }
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 27
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください
セクション 1. 章 27