Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yihan12 authored Dec 12, 2023
1 parent b3c012e commit 11db9ed
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions javascript/variables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

## let、const和var

* var 语句 用于声明一个函数范围或全局范围的变量,并可将其初始化为一个值(可选)。
* var 语句 用于声明一个函数范围或全局范围的变量,并可将其初始化为一个值(可选)。(var关键字只能在为旧浏览器编写的代码中使用。)
* let 声明用于声明可重新赋值的块级作用域局部变量,并且可以将每个变量初始化为一个值(可选)。
* 常量是块级范围的,非常类似用 let 语句定义的变量。但常量的值是无法(通过重新赋值)改变的,也不能被重新声明。

* const 常量是块级范围的,非常类似用 let 语句定义的变量。但常量的值是无法(通过重新赋值)改变的,也不能被重新声明。()

```javascript
const price1 = 5;
const price2 = 6;
let total = price1 + price2;
```

# Hoisting(变量提升)

Expand Down

0 comments on commit 11db9ed

Please sign in to comment.