Created
August 20, 2012 18:22
-
-
Save nicholasbs/3406421 to your computer and use it in GitHub Desktop.
Example 1 (Chrome profiler)
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
<html> | |
<head> | |
<script> | |
function makeClosure () { | |
var str = "This string was closed over"; | |
return function () { | |
console.log(str); | |
}; | |
}; | |
var myClosure = makeClosure(); | |
myClosure(); // prints "This string was closed over" | |
</script> | |
</head> | |
<title>Example #1</title> | |
<body> | |
<h1>Example #1</h1> | |
<p> | |
Open up the Chrome profiler and follow the steps in the post. | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment