javascript pour chaque boucle
var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
console.log(color);
});
Grepper
var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
console.log(color);
});
public class Sample {
public static void main(String[] args) {
String names[] = { "Jasmine", "Lyka", "Marbie", "Soleen", "Tiny" };
for (String name : names) {
System.out.println(name);
}
}
}
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
// expected output: "a"
// expected output: "b"
// expected output: "c"
const a = ["a", "b", "c"];
for (const val of a) { // You can use `let` instead of `const` if you like
console.log(val);
}
array.forEach(element => {
// syntex
});
String[] fruits = {"apples", "oranges", "pears", "plums"}
for (String i:fruits)
{
System.out.print(i);
}