Last active
November 4, 2021 17:38
-
-
Save LoganBarnett/fa67015e6589ea514d1360e368b90480 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
const fs = [] | |
for(var i = 0; i < 3; ++i) { | |
fs.push(() => console.log(i)) | |
} | |
fs.forEach(f => f()) | |
// with explicit scope | |
const fs = [] | |
const scope = { i: 0 } | |
for(; scope.i < 3; ++scope.i) { | |
fs.push(() => console.log(scope.i)) | |
} | |
fs.forEach(f => f()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Ruby version: