Difference between revisions of "Loops"
Jump to navigation
Jump to search
(Created page with "==Foreach Loop== <pre> var letters=["a", "b", "c"]; letters.forEach(function(items){ console.log(items); }); </pre>") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Foreach Loop== | ==Foreach Loop== | ||
<pre> | <pre> | ||
var i=0; | |||
var letters=["a", "b", "c"]; | var letters=["a", "b", "c"]; | ||
letters.forEach(function(items){ | letters.forEach(function(items){ | ||
console.log(items); | console.log(i + " - " +items); | ||
i++; | |||
}); | }); | ||
</pre> | </pre> | ||
==[[#top|Back To Top]]-[[Main_Page| Home]] - [[Java Script|Category]]== |
Latest revision as of 14:15, 28 October 2016
Foreach Loop
var i=0; var letters=["a", "b", "c"]; letters.forEach(function(items){ console.log(i + " - " +items); i++; });