blob: 79178237308949723299cab642195ed6b33597cc (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
---
title: JavaScript 指南
slug: Web/JavaScript/Guide
tags:
- Guide
- JavaScript
translation_of: Web/JavaScript/Guide
---
<div>{{jsSidebar("JavaScript Guide")}}</div>
<p>JavaScript 指南向你介绍如何使用 <a href="/zh-CN/docs/Web/JavaScript">JavaScript</a>,并且给出了语言概述。如果你需要了解某些语言特性的详细信息,请参阅 <a href="/zh-CN/docs/Web/JavaScript/Reference">JavaScript 参考</a>。</p>
<h2 id="章节">章节</h2>
<p>本指南分为以下章节:</p>
<ul class="card-grid">
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction">介绍</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction#What_is_JavaScript.3F">关于这份指南</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction#什么是_JavaScript">关于 JavaScript</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction#JavaScript_and_Java">JavaScript 与 Java</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction#JavaScript_and_the_ECMAScript_Specification">ECMAScript</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction#Getting_started_with_JavaScript">工具</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Introduction#Hello_world">Hello World</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types">语法与数据类型</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#基础">基本语法与注释</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#声明">声明</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#变量的作用域">变量作用域</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#变量提升">变量提升</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#数据结构和类型">数据结构和类型</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Grammar_and_types#字面量_(Literals)">字面量</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Control_flow_and_error_handling">控制流与错误处理</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#if...else_语句"><code>if...else</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#switch_语句"><code>switch</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#异常处理语句"><code>try</code>/<code>catch</code>/<code>throw</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#使用Error对象">Error 对象</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration">循环与迭代</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#for_语句"><code>for</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#while_语句"><code>while</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#do...while_语句"><code>do...while</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#break_语句"><code>break</code></a>/<a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#continue_语句"><code>continue</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#for...in_语句"><code>for..in</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Loops_and_iteration#for...of_语句"><code>for..of</code></a></p>
</li>
</ul>
<ul class="card-grid">
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Functions">函数</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#定义函数">定义函数</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#调用函数">调用函数</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#函数作用域">函数作用域</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#闭包">闭包</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#使用_arguments_对象">arguments 对象</a> 和 <a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#函数参数">参数</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Functions#箭头函数">箭头函数</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators">表达式和运算符</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#赋值运算符(Assignment_operators)">赋值</a> & <a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#比较运算符(Comparison_operators)">比较</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#算术运算符(Arithmetic_operators)">算术运算符</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#位运算符(Bitwise_operators)">位运算</a> & <a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#逻辑运算符(Logical_operators)">逻辑运算符</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#conditional_operator">条件(三元)运算符</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Numbers_and_dates">数字与日期</a> <a href="/zh-CN/docs/Web/JavaScript/Guide/Numbers_and_dates#数字"><code>Number</code> 字面量</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Numbers_and_dates#数字对象"><code>Number</code> 对象</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Numbers_and_dates#数学对象(Math)"><code>Math</code> 对象</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Numbers_and_dates#日期对象"><code>Date</code> 对象</a></li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Text_formatting">文本格式化</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Text_formatting#字符串">字符串字面量</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Text_formatting#字符串对象">字符串对象</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Text_formatting#多行模板字符串">模版字面量</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Text_formatting#国际化">国际化</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions">正则表达式</a></p>
</li>
</ul>
<ul class="card-grid">
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Indexed_collections">索引集合</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Indexed_collections#map%E6%95%B0%E7%BB%84">数组</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Indexed_collections#类型化数组(Typed_Arrays_)">类型数组</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Keyed_collections">带键集合</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Keyed_collections#Map对象"><code>Map</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Keyed_collections#WeakMap对象"><code>WeakMap</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Keyed_collections#Set对象"><code>Set</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Keyed_collections#WeakSet对象"><code>WeakSet</code></a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Working_with_Objects">处理对象</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Working_with_Objects#%E5%AF%B9%E8%B1%A1%E5%92%8C%E5%B1%9E%E6%80%A7_2">对象和属性</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Working_with_Objects#%E5%88%9B%E5%BB%BA%E6%96%B0%E5%AF%B9%E8%B1%A1">创建对象</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Working_with_Objects#%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95">定义方法</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Working_with_Objects#%E5%AE%9A%E4%B9%89_getters_%E4%B8%8E_setters">getter 和 setter</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Details_of_the_Object_Model">对象模型的细节</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#class-based_vs_prototype-based_languages">基于原型的面向对象编程</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#%E5%88%9B%E5%BB%BA%E5%B1%82%E7%BA%A7%E7%BB%93%E6%9E%84">创建对象层次结构</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Details_of_the_Object_Model#%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%B1%9E%E6%80%A7">继承</a></p>
</li>
</ul>
<ul class="card-grid">
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises">Promises</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises#%E7%BA%A6%E5%AE%9A">约定</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises#%E9%93%BE%E5%BC%8F%E8%B0%83%E7%94%A8">链式调用</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises#%E9%94%99%E8%AF%AF%E4%BC%A0%E9%80%92">错误传递</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises#%E7%BB%84%E5%90%88">组合</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Using_promises#%E6%97%B6%E5%BA%8F">时序</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Iterators_and_Generators">迭代器与生成器</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Iterators_and_Generators#%E8%BF%AD%E4%BB%A3%E5%99%A8">迭代器</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Iterators_and_Generators#%E7%94%9F%E6%88%90%E5%99%A8">生成器</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Iterators_and_Generators#%E5%8F%AF%E8%BF%AD%E4%BB%A3%E5%AF%B9%E8%B1%A1">可迭代对象</a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Meta_programming">元编程</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Meta_programming#%E4%BB%A3%E7%90%86"><code>Proxy</code></a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Meta_programming#%E5%8F%A5%E6%9F%84%E5%92%8C%E9%99%B7%E9%98%B1">Handlers 和 traps</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Meta_programming#%E6%92%A4%E9%94%80_Proxy">撤销 Proxy</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Meta_programming#%E5%8F%8D%E5%B0%84"><code>Reflect</code></a></p>
</li>
<li><a href="/zh-CN/docs/Web/JavaScript/Guide/Modules">JavaScript 模块</a>
<p><a href="/zh-CN/docs/Web/JavaScript/Guide/Modules#Exporting_module_features">导出模块</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Modules#Importing_features_into_your_script">导入模块</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Modules#Default_exports_versus_named_exports">默认导出</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Modules#Renaming_imports_and_exports">重命名模块</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Modules#Aggregating_modules">合并模块</a><br>
<a href="/zh-CN/docs/Web/JavaScript/Guide/Modules#Dynamic_module_loading">动态加载模块</a></p>
</li>
</ul>
<p>{{Next("Web/JavaScript/Guide/Introduction")}}</p>
|