Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

docs: Update terminology from 'parameter' and 'argument'#1266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
GeoDaoyu wants to merge1 commit intojavascript-tutorial:master
base:master
Choose a base branch
Loading
fromGeoDaoyu:patch-2
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions1-js/02-first-steps/15-function-basics/article.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -172,23 +172,23 @@ showMessage(from, "Hello"); // *Ann*: Hello
alert( from ); // Ann
```

当一个值被作为函数参数(parameter)传递时,它也被称为 **参数(argument)**。
当一个值被作为函数参数(parameter)传递时,它也被称为 **实参(argument)**。

换一种方式,我们把这些术语搞清楚:

-参数(parameter)是函数声明中括号内列出的变量(它是函数声明时的术语)。
-参数(argument)是调用函数时传递给函数的值(它是函数调用时的术语)。
-形参(parameter)是函数声明中括号内列出的变量(它是函数声明时的术语)。
-实参(argument)是调用函数时传递给函数的值(它是函数调用时的术语)。

我们声明函数时列出它们的参数(parameters),然后调用它们传递参数(arguments)。
我们声明函数时列出它们的形参(argument),然后调用它们传递实参(argument)。

在上面的例子中,我们可以说:“函数 `showMessage` 被声明,并且带有两个参数(parameters),随后它被调用,两个参数(arguments)分别为 `from` 和 `"Hello"`”。
在上面的例子中,我们可以说:“函数 `showMessage` 被声明,并且带有两个形参(parameters),随后它被调用,两个实参(arguments)分别为 `from` 和 `"Hello"`”。


## 默认值

如果一个函数被调用,但有参数(argument)未被提供,那么相应的值就会变成 `undefined`。
如果一个函数被调用,但有实参(argument)未被提供,那么相应的值就会变成 `undefined`。

例如,之前提到的函数 `showMessage(from, text)`可以只使用一个参数(argument)调用:
例如,之前提到的函数 `showMessage(from, text)`可以只使用一个实参(argument)调用:

```js
showMessage("Ann");
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp