Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2016 03:55
Show Gist options
  • Save anonymous/7ad3b4d6007e5e14c424aeef3e86198d to your computer and use it in GitHub Desktop.
Save anonymous/7ad3b4d6007e5e14c424aeef3e86198d to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/poxuce
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
"use strict";
var message = "hi";
{
var _message = "bye";
}
console.log(message);
var fs = [];
var _loop = function (i) {
// var/let i
fs.push(function () {
return console.log(i);
});
};
for (var i = 0; i < 10; i++) {
_loop(i);
}
fs.forEach(function (f) {
return f();
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">let message = "hi";
{
let message = "bye";
}
console.log(message);
let fs = [];
for(let i = 0; i < 10; i++) { // var/let i
fs.push(() => console.log(i));
}
fs.forEach( f => f() )
</script></body>
</html>
"use strict";
var message = "hi";
{
var _message = "bye";
}
console.log(message);
var fs = [];
var _loop = function (i) {
// var/let i
fs.push(function () {
return console.log(i);
});
};
for (var i = 0; i < 10; i++) {
_loop(i);
}
fs.forEach(function (f) {
return f();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment