Skip to content

Commit ef1ec1f

Browse files
committed
20170727
1 parent ffdb176 commit ef1ec1f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

WEEK1/DAY3/2-scope.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>作用域</title>
6+
</head>
7+
<body>
8+
<script>
9+
var num = 12;
10+
function fn() {
11+
var num = 13;
12+
return function (i) {
13+
console.log(num + i++);
14+
}
15+
}
16+
var f = fn();
17+
f(10);
18+
fn()(10);//->先把FN执行,把执行的返回结果(小函数)再执行,等价于上面赋值给F的两句话
19+
fn()(20);
20+
f(20);
21+
22+
23+
</script>
24+
</body>
25+
</html>

WEEK1/DAY3/2.png

93.9 KB
Loading

0 commit comments

Comments
 (0)