Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
vault backup: 2023-12-09 17:00:50
Browse files Browse the repository at this point in the history
  • Loading branch information
liamfrazer committed Dec 9, 2023
1 parent fe0a706 commit c414805
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/React/The Complete Guide Docs/functions and parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ function greet() {
greet() // Hello World!
```

* Functions can take parameters,
* Functions can take parameters, knows as input values
* Parameters are then available within the scope of the function
* The idea behind parameters, is that you can have one re-usable function, that can be re-used with different input values
```js
function greet(userName, message) {
console.log(`${message} ${userName}`);
}

greet("Liam", "Hello");
greet("Frazer", "Hello")
```

* You can assign default values to parameters, by adding a `=` sign
* The default value can be overridden, by simply providing a value

0 comments on commit c414805

Please sign in to comment.