Created
August 17, 2018 21:22
-
-
Save segdeha/d041a8489c01393138d399cb69ed86e2 to your computer and use it in GitHub Desktop.
`for of` versus `forEach`
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
let arr = ['a', 'b', 'c']; | |
for (const [i, x] of arr.entries()) { | |
console.log(i, x); | |
} | |
arr.forEach((x, i ) => { | |
console.log(i, x); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment