Skip to content

Instantly share code, notes, and snippets.

@gilles-leblanc
Created April 13, 2013 17:53
Show Gist options
  • Save gilles-leblanc/5379379 to your computer and use it in GitHub Desktop.
Save gilles-leblanc/5379379 to your computer and use it in GitHub Desktop.
Variable hoisting 2
/** Variable hoisting 2
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
<!-- content to be placed inside <body>…</body> -->
<div id="first-element"></div>
var i = 10;
// block scope
{
for (i = 0; i <= 20; i++) {
// do stuff
}
}
document.getElementById("first-result").innerHTML = i;
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment