Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example 1 (Chrome profiler)
<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
You can’t perform that action at this time.