# 章序号/节序号/节/笔记序号
codecademy,function
# 概念阐释
### 行参
- 需要函数执行特定的任务时需要在声明函数时提供**行参parameters,行参的行为类似于变量**。

### 值作为实参
- 调用带有行参的函数时,需要在调用函数的括号内指定一些值,**这些值叫做行参,就像变量名需要赋值**。

### 变量名作为实参
- 不一定在调用函数时直接写值,也可以在`()` 中使用变量。

# 举例子


# 类比、比较与对比
- 行参=变量名
- 实参=变量值
- 实参=新的(有值的)变量名
# 问题
[练习题](https://www.codecademy.com/courses/introduction-to-javascript/lessons/functions/exercises/parameters)
**1.**
The `sayThanks()` function works well, but let’s add the customer’s name in the message.
Add a parameter called `name` to the function declaration for `sayThanks()`.
**2.**
With `name` as a parameter, it can be used as a variable in the function body of `sayThanks()`.
Using `name` and string concatenation, change the thank you message into the following:
```
'Thank you for your purchase '+ name + '! We appreciate your business.'
```
Copy and paste the above message into your code.
**3.**
A customer named Cole just purchased something from your online store. Call `sayThanks()` and pass `'Cole'` as an argument to send Cole a personalized thank you message.
# 问题答案
```js
function sayThanks(name) {
console.log('Thank you for your purchase '+ name + '! We appreciate your business.');//行参相当于变量名
}
sayThanks('Cole');//实参相当于变量值
```
# 备注(经验集/错误集)