Home  »  CodeGuidesLibrariesProgrammingSnippetsTechnology   »   JavaScript Example of Array Foreach Loop

JavaScript Example of Array Foreach Loop

Posted: January 2, 2023 | by Michael Bright

JavaScript example of an Array Foreach Loop code.

var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
    console.log(color);
});

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.