Skip to content

Commit 9ead4c5

Browse files
基础语法
1 parent 07fee2b commit 9ead4c5

20 files changed

+56
-131
lines changed

01-JS语言基础/基础语法/01-起步.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,9 @@
2222
document.write("<h1>h1标签</h1>");//页面输出内容而且识别标签
2323

2424
function fn(a,b){
25-
return 111;
25+
return 1;
2626
}
2727

28-
// 声明提升
29-
//1
30-
var a = 18;
31-
f1();
32-
function f1(){
33-
var b=9;
34-
console.log(a);//undefined
35-
console.log(b);//9
36-
var a = '123';
37-
}
38-
//2
39-
f2();
40-
console.log(cc);// 9
41-
console.log(bb);// 9
42-
console.log(aa);// 报错 is not defined
43-
function f2(){
44-
var aa = bb = cc = 9;
45-
console.log(aa);// 9
46-
console.log(bb);// 9
47-
console.log(cc);// 9
48-
}
4928
</script>
5029
</body>
5130
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title></title>
6+
</head>
7+
<body>
8+
<script type="text/javascript">
9+
// 声明提升
10+
//1
11+
var a = 18;
12+
f1();
13+
function f1(){
14+
var b=9;
15+
console.log(a);//undefined
16+
console.log(b);//9
17+
var a = '123';
18+
}
19+
//2
20+
f2();
21+
console.log(cc);// 9
22+
console.log(bb);// 9
23+
console.log(aa);// 报错 is not defined
24+
function f2(){
25+
var aa = bb = cc = 9;
26+
console.log(aa);// 9
27+
console.log(bb);// 9
28+
console.log(cc);// 9
29+
}
30+
</script>
31+
</body>
32+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
</head>
77
<body>
88
<script>
9+
//1.函数声明
10+
function funcName(){
11+
//函数体
12+
}
13+
14+
//2.函数表达式
15+
//在使用函数表达式声明函数的时候,function后面可以跟函数名,只限在函数内部使用,外部无法访问
16+
var funcName1 = function name(){
17+
//函数体
18+
}
19+
funcName1();
20+
21+
//3.Function
22+
var funcName2 = new Function();
23+
924
//函数就是具有一定功能的可以重复执行的代码块
1025
//函数的组成分为: 1.参数 2.返回值 3.功能
1126
//如果函数名相同,后面的函数会覆盖前面的函数(函数名不能一样)

01-JS语言基础/基础语法/11-数组.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

01-JS语言基础/基础语法/12-break和continue.html

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)