js0015

执行上下文来跟踪代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html>
<head>
<title>The creation of execution contexts</title>
<meta charset="utf-8">
<script src="../assert.js"></script>
<link rel="stylesheet" type="text/css" href="../assert.css">
</head>
<body>
<script type="text/javascript">
function skulk(ninja) {
report(ninja + " skulking");
}

function report(message) {
console.log(message);
}

skulk("Kuma");
skulk("Yoshi");
</script>
<p>Outputs to the console (press F12)</p>
</body>
</html>