Answers for "for each() example"

35

for each js

const fruits = ['mango', 'papaya', 'pineapple', 'apple'];

// Iterate over fruits below

// Normal way
fruits.forEach(function(fruit){
  console.log('I want to eat a ' + fruit)
});
Posted by: Guest on March-29-2020
20

javascript for each loop

var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
    console.log(color);
});
Posted by: Guest on July-19-2019

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language