-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathoptimized-away.html
More file actions
40 lines (36 loc) · 966 Bytes
/
optimized-away.html
File metadata and controls
40 lines (36 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Optimized Away</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<style>
body { padding-top: 2em; }
</style>
</head>
<body>
<div class="container">
<button class="btn btn-primary" id="c">Click to Pause</button> and then:
<ol>
<li>select <strong>z</strong> in the <u>Call Stack</u></li>
<li>look for <strong>x</strong> under the <strong>f</strong> group in the <u>Scopes</u> section</li>
</ol>
</div>
<script>
function f(x, y) {
console.log(x);
return function z() {
return breakpoint(y);
};
}
function breakpoint() {
debugger;
}
var closure = f(10, "yess");
function click() {
closure();
}
document.getElementById("c").onclick = click;
</script>
</body>
</html>