Skip to content

Commit b38d5ec

Browse files
authored
Merge pull request #544 from cpxPratik/patch-6
Update article.md
2 parents 1782f06 + c64136a commit b38d5ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

1-js/02-first-steps/04-variables/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ let return = 5; // also can't name it "return", error!
209209

210210
````warn header="An assignment without `use strict`"
211211

212-
Normally, we need to define a variable before using it. But in the old times, it was technically possible to create a variable by a mere assignment of the value, without `let`. This still works now in if we don't put `use strict`, the behavior is kept for compatibility with old scripts.
212+
Normally, we need to define a variable before using it. But in the old times, it was technically possible to create a variable by a mere assignment of the value, without `let`. This still works now if we don't put `use strict`, the behavior is kept for compatibility with old scripts.
213213

214214
```js run no-strict
215215
// note: no "use strict" in this example
@@ -303,11 +303,11 @@ Please spend some time thinking about the right name for a variable before decla
303303
Some good-to-follow rules are:
304304
305305
- Use human-readable names like `userName` or `shoppingCart`.
306-
- Stay away from abbreviations or short names `a`, `b`, `c`, unless you really know what you're doing.
306+
- Stay away from abbreviations or short names like `a`, `b`, `c`, unless you really know what you're doing.
307307
- Make the name maximally descriptive and concise. Examples of bad names are `data` and `value`. Such a name says nothing. It is only ok to use them if it's exceptionally obvious from the context which data or value is meant.
308308
- Agree on terms within the team and in your own mind. If a site visitor is called a "user" then we should name related variables like `currentUser` or `newUser`, but not `currentVisitor` or a `newManInTown`.
309309
310-
Sounds simple? Indeed it is. But creating good descriptive-and-concise names in practice is not. Go for it.
310+
Sounds simple? Indeed it is, but creating good descriptive-and-concise names in practice is not. Go for it.
311311
312312
```smart header="Reuse or create?"
313313
And the last note. There are some lazy programmers who, instead of declaring a new variable, tend to reuse the existing ones.
@@ -327,6 +327,6 @@ We can declare variables to store data. That can be done using `var` or `let` or
327327
328328
- `let` -- is a modern variable declaration. The code must be in strict mode to use `let` in Chrome (V8).
329329
- `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 if you'll need them.
330-
- `const` -- is like `let`, but the variable can't be changed.
330+
- `const` -- is like `let`, but the value of variable can't be changed.
331331
332332
Variables should be named in a way that allows to easily understand what's inside.

0 commit comments

Comments
 (0)