Last active
July 8, 2018 21:50
-
-
Save sevperez/2d06a856511e4c485c524ae852626ca3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 prices = [400, 80, 375, 870]; | |
// 1 | |
for (var i = 0; i < prices.length; i += 1) { | |
console.log(prices[i]); | |
} | |
// logs 400, 80, 375, 870 | |
// 2 | |
for (var k in prices) { | |
console.log(prices[k]); | |
} | |
// logs 400, 80, 375, 870 | |
// 3 | |
for (var v of prices) { | |
console.log(v); | |
} | |
// logs 400, 80, 375, 870 | |
// 4 | |
prices.forEach(function(val) { | |
console.log(val); | |
}); | |
// logs 400, 80, 375, 870 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment