|
|
|
EcmaScript 6.0 Walk through
|
|
|
|
====
|
|
|
|
|
|
|
|
### 1. Understanding variable declare and scope
|
|
|
|
|
|
|
|
| Declare | Scope |
|
|
|
|
| ---- | ---- |
|
|
|
|
| let | Block |
|
|
|
|
| var | Function |
|
|
|
|
| const | Block |
|
|
|
|
| function | Block |
|
|
|
|
| class | Block |
|
|
|
|
| import | Module-Global |
|
|
|
|
|
|
|
|
### 1.1 **var** vs **let** vs **const**
|
|
|
|
|
|
|
|
#### var
|
|
|
|
Simple variable declare in last javascript
|
|
|
|
|
|
|
|
#### let
|
|
|
|
let is like a **var** but it declares is block-scoped
|
|
|
|
|
|
|
|
#### const
|
|
|
|
Declare is block-scope like a **let** but it's value can't change
|
|
|
|
|