foreach javas code example
Example 1: javascript foreach
const avengers = ['thor', 'captain america', 'hulk'];
avengers.forEach((item, index)=>{
console.log(index, item)
})
Example 2: es6 forEach
const array1 = ['a', 'b', 'c'];
array1.forEach((element) => {
console.log(element)
});
Example 3: java for each
for(<Data Type> item : itemset) {
}
Example 4: for each java
int [] intArray = { 10, 20, 30, 40, 50 };
for( int value : intArray ) {
System.out.println( value );
}
Example 5: java foreach
List<String> someList = new ArrayList<String>();
for (String item : someList) {
System.out.println(item);
}
Example 6: foreach jas
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));