mirror of
https://github.com/alrayyes/wiki.git
synced 2025-07-23 01:13:27 +00:00
Quartz sync: May 6, 2024, 10:40 PM
This commit is contained in:
parent
aee9145691
commit
4ef8371441
635 changed files with 22281 additions and 6 deletions
32
content/20201006111125-javascript_function_declerations.md
Normal file
32
content/20201006111125-javascript_function_declerations.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
id: 0e8d8e26-e36d-48b6-a333-9c0fbd07b7b0
|
||||
title: JavaScript function declarations
|
||||
---
|
||||
|
||||
``` javascript
|
||||
const square = function(x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
console.log(square(12))
|
||||
```
|
||||
|
||||
``` javascript
|
||||
const makeNoise = function() {
|
||||
console.log("Pling!")
|
||||
}
|
||||
|
||||
makeNoise()
|
||||
```
|
||||
|
||||
``` javascript
|
||||
const power = function(base, exponent) {
|
||||
let result = 1;
|
||||
for (let count = 0; count < exponent; count++) {
|
||||
result *= base;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
console.log(power(2, 10))
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue