Skip to content

Instantly share code, notes, and snippets.

@azproduction
Created May 8, 2011 00:05
Show Gist options
  • Save azproduction/960982 to your computer and use it in GitHub Desktop.
Save azproduction/960982 to your computer and use it in GitHub Desktop.
Let test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Let - FF Only</title>
</head>
<body>
<script type="application/javascript;version=1.7">
(function () {
for (var x = 0, data = []; x < 3; x++) {
let y = x;
data[x] = function () {alert(y);}
}
data[1]();
// for (/* hire */) {/* and there */} different scopes
for (let z = 0, data = []; z < 3; data[z] = function () {alert(z);}, z++);
data[1]();
for (var z = 0, data = []; z < 3; data[z] = function () {alert(z);}, z++);
data[1]();
}());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment