Changed var to const (#22486)
Changed var to const to resemble the English version of the file
This commit is contained in:
committed by
Kristofer Koishigawa
parent
804132b43b
commit
9a13212e2f
@ -19,17 +19,17 @@ if (!variable) {
|
|||||||
## 一般例子
|
## 一般例子
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var string = ""; // <-- falsy
|
const string = ""; // <-- falsy
|
||||||
|
|
||||||
var filledString = "some string in here"; // <-- truthy
|
const filledString = "some string in here"; // <-- truthy
|
||||||
|
|
||||||
var zero = 0; // <-- falsy
|
const zero = 0; // <-- falsy
|
||||||
|
|
||||||
var numberGreaterThanZero // <-- truthy
|
let numberGreaterThanZero; // <-- falsy
|
||||||
|
|
||||||
var emptyArray = []; // <-- truthy, we'll explore more about this next
|
const emptyArray = []; // <-- truthy, we'll explore more about this next
|
||||||
|
|
||||||
var emptyObject = {}; // <-- truthy
|
const emptyObject = {}; // <-- truthy
|
||||||
```
|
```
|
||||||
|
|
||||||
## 有阵列的乐趣
|
## 有阵列的乐趣
|
||||||
@ -71,4 +71,4 @@ const match = { teamA: 0, teamB: 1 }
|
|||||||
|
|
||||||
* [Falsy |词汇表| MDN](https://developer.mozilla.org/en-US/docs/Glossary/Falsy)
|
* [Falsy |词汇表| MDN](https://developer.mozilla.org/en-US/docs/Glossary/Falsy)
|
||||||
|
|
||||||
* [Truthy和Falsy:当JavaScript中的所有不相等时](https://www.sitepoint.com/javascript-truthy-falsy/)
|
* [Truthy和Falsy:当JavaScript中的所有不相等时](https://www.sitepoint.com/javascript-truthy-falsy/)
|
||||||
|
Reference in New Issue
Block a user