Answers for "foreach loop syntax"

1

foreach loop javascript

var array = ["a","b","c"];
// example 1
  for(var value of array){
    console.log(value);
    value += 1;
  }

// example 2
  array.forEach((item, index)=>{
    console.log(index, item)
  })
Posted by: Guest on October-24-2021
6

foreach loop javascript

const numList = [1, 2, 3];

numList.forEach((number) => {
  console.log(number);
});
Posted by: Guest on October-05-2020
3

for each java

public class ForEachLoopExample
{
   public static void main(String[] args)
   {
      int[] numbers = {2, 4, 6, 8, 10};
      // for each loop
      for(int n : numbers)
      {
         System.out.println(n);
      }
   }
}
Posted by: Guest on October-23-2020
0

foreach loop javascript

listName.forEach((listItem) => {
  Logger.log(listItem);
}):
Posted by: Guest on November-17-2020
-2

foreach loop

foreach ($array as $value)
{

  code to be executed;

 }
Posted by: Guest on June-08-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language