Created
June 23, 2011 22:26
-
-
Save latentflip/1043783 to your computer and use it in GitHub Desktop.
This file contains 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
<script type="text/javascript"> | |
var a_function = function() { | |
var a_number = 2; | |
document.write('Within a_function, a_number = '+a_number+'<br>'); | |
return function(a) { | |
document.write('Within the callback, a_number = '+a_number+'<br>'); | |
document.write('Within the callback, I was passed = '+a+'<br>'); | |
document.write('Within the callback, a * a_number = '+a*a_number+'<br>'); | |
} | |
}; | |
var callback = a_function(); | |
document.write('Outwith a_function, a_number = '+window.a_number+'<br>'); | |
callback(10); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment