All Tracks/top learn function basics/
Đang tải...
Hướng dẫn thử thách
1 / 6

Learn Function Basics Lesson A

Let’s discuss parameters and arguments in the context of the following example function: ```js function favoriteAnimal(animal) { return animal + " is my favorite animal!" } console.log(favoriteAnimal('Goat')); ``` In JavaScript, parameters are the items listed between the parentheses `()` in the function declaration. Function arguments are the actual values you decide to pass to the function. In the example above, the function definition is written on the first line: `function favoriteAnimal(animal)`. The parameter, `animal`, is found inside the parentheses. You could just as easily replace `animal` with `pet`, `x`, or `blah`. But in this case, naming the parameter `animal` gives someone reading your code a bit of context so that they don't have to guess what `animal` may eventually contain.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.js
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.