var arr = ["f", "o", "o", "b", "a", "r"];
for(var i in arr){
console.log(arr[i]);
}
let iterable = [10, 20, 30];
for (let value of iterable) {
value += 1;
console.log(value);
}
// 11
// 21
// 31
const cars = ["mazda", "BMW", "Volkswagen", "Audi"]
for (let i = 0; i < cars.length; i++) {
text += cars[i];
}
//pass an array of numbers into a function and log each number to the console
function yourFunctionsName(arrayToLoop){
//Initialize 'i' as your counter set to 0
//Keep looping while your counter 'i' is less than your arrays length
//After each loop the counter 'i' is to increased by 1
for(let i = 0; i <arrayToLoop.length; i++){
//during each loop we will console.log the current array's element
//we use 'i' to designate the current element's index in the array
console.log(arrayToLoop[i])
}
}
//Function call below to pass in example array of numbers
yourFunctionsName([1, 2, 3, 4, 5, 6])
for (var j = 0; j < myArray.length; j++){
console.log(myArray[j.x]);
}
const colors = ["red","blue","green"];
for (const color of colors) {
console.log(color);
}