mirror of
https://github.com/alrayyes/wiki.git
synced 2025-07-24 17:59:33 +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
45
content/20200613172137-binding_variables_in_javascript.md
Normal file
45
content/20200613172137-binding_variables_in_javascript.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
id: 6efc70be-8154-420f-a92e-622ef1ad960c
|
||||
title: Binding / Variables in JavaScript
|
||||
---
|
||||
|
||||
# ES6
|
||||
|
||||
## Let
|
||||
|
||||
``` javascript
|
||||
let caught = 5 * 5
|
||||
console.log(caught)
|
||||
|
||||
let mood = "light"
|
||||
console.log(mood)
|
||||
mood = "dark"
|
||||
console.log(mood)
|
||||
|
||||
let luigisDebt = 140;
|
||||
luigisDebt = luigisDebt - 35;
|
||||
console.log(luigisDebt);
|
||||
```
|
||||
|
||||
A single let statement my define multiple bindings
|
||||
|
||||
``` javascript
|
||||
let one = 1, two = 2
|
||||
console.log(one + two)
|
||||
```
|
||||
|
||||
## Const
|
||||
|
||||
This is a constant binding. It points to the same value for as long as
|
||||
it lives
|
||||
|
||||
``` javascript
|
||||
const blaat = "abcd"
|
||||
console.log(blaat)
|
||||
/**
|
||||
* Following will both cause errors:
|
||||
*
|
||||
* blaat = "efgh"
|
||||
* let blaat = "efgh"
|
||||
*/
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue