Last active
January 24, 2017 22:04
-
-
Save davodey/931ce32fa2bd9aa5489e16ea58f1e6e3 to your computer and use it in GitHub Desktop.
Example using the ES6 forEach helper.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colors = [ 'red', 'blue', 'green']; | |
// syntax we want to move away from | |
for (var i = 0; i < colors.length; i++) { | |
console.log(colors[i]); | |
} | |
// syntax we want to use | |
colors.forEach(function(color){ | |
console.log(color); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment