minor fixes
This commit is contained in:
parent
689975093c
commit
f6ff773033
24 changed files with 67 additions and 76 deletions
|
@ -1,4 +1,4 @@
|
|||
First, the variable for the name of our planet.
|
||||
## The variable for our planet
|
||||
|
||||
That's simple:
|
||||
|
||||
|
@ -8,7 +8,7 @@ let ourPlanetName = "Earth";
|
|||
|
||||
Note, we could use a shorter name `planet`, but it might be not obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong.
|
||||
|
||||
Second, the name of the current visitor:
|
||||
## The name of the current visitor
|
||||
|
||||
```js
|
||||
let currentUserName = "John";
|
||||
|
|
|
@ -2,4 +2,4 @@ We generally use upper case for constants that are "hard-coded". Or, in other wo
|
|||
|
||||
In this code, `birthday` is exactly like that. So we could use the upper case for it.
|
||||
|
||||
In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`, it is calculated, so we should keep the lower case for it.
|
||||
In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`: it is calculated, so we should keep the lower case for it.
|
||||
|
|
|
@ -323,7 +323,7 @@ Modern JavaScript minifiers and browsers optimize code well enough, so it won't
|
|||
|
||||
We can declare variables to store data by using the `var`, `let`, or `const` keywords.
|
||||
|
||||
- `let` -- is a modern variable declaration. The code must be in strict mode to use `let` in Chrome (V8).
|
||||
- `let` -- is a modern variable declaration.
|
||||
- `var` -- is an old-school variable declaration. Normally we don't use it at all, but we'll cover subtle differences from `let` in the chapter <info:var>, just in case you need them.
|
||||
- `const` -- is like `let`, but the value of the variable can't be changed.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue