docs(web): 更新javascript基础文档中函数部分的描述
添加函数声明格式说明并完善函数定义描述
This commit is contained in:
@@ -293,7 +293,7 @@ while (count <= 5) {
|
||||
|
||||
## 函数
|
||||
|
||||
函数是可重用的代码块,用于执行特定任务。
|
||||
函数是一段可重复使用的代码块,可以接受输入(参数),执行操作,并返回输出(返回值)。
|
||||
|
||||
### 函数声明
|
||||
|
||||
@@ -306,6 +306,15 @@ const message = greet("小明");
|
||||
console.log(message); // 输出:你好,小明!
|
||||
```
|
||||
|
||||
格式如下
|
||||
|
||||
```javascript
|
||||
function 函数名(参数1, 参数2, ...参数N) {
|
||||
// 函数体:要执行的代码
|
||||
return 返回值; // 可选
|
||||
}
|
||||
```
|
||||
|
||||
### 箭头函数(ES6)
|
||||
|
||||
```javascript
|
||||
|
||||
Reference in New Issue
Block a user