Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript foreach

const colors = ['blue', 'green', 'white'];

function iterate(item) {
  console.log(item);
}

colors.forEach(iterate);
// logs "blue"
// logs "green"
// logs "white"
Source by dmitripavlutin.com #
 
PREVIOUS NEXT
Tagged: #javascript #foreach
ADD COMMENT
Topic
Name
7+8 =