Skip to content

Commit 9cb597e

Browse files
committed
minor fixes
1 parent 8f2ae7e commit 9cb597e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,6 @@ let user = 'John'
8080

8181
Technically, all these variants do the same thing. So, it's a matter of personal taste and aesthetics.
8282

83-
````warn header="Declaring twice triggers an error"
84-
A variable should be declared only once.
85-
86-
A repeated declaration of the same variable is an error:
87-
88-
```js run
89-
let message = "This";
90-
91-
// repeated 'let' leads to an error
92-
let message = "That"; // SyntaxError: 'message' has already been declared
93-
```
94-
So, we declare a variable once, and then should refer to it without `let`.
95-
````
96-
9783
````smart header="`var` instead of `let`"
9884
In older scripts, you may also find another keyword: `var` instead of `let`:
9985

@@ -148,6 +134,20 @@ alert(hello); // Hello world!
148134
alert(message); // Hello world!
149135
```
150136
137+
````warn header="Declaring twice triggers an error"
138+
A variable should be declared only once.
139+
140+
A repeated declaration of the same variable is an error:
141+
142+
```js run
143+
let message = "This";
144+
145+
// repeated 'let' leads to an error
146+
let message = "That"; // SyntaxError: 'message' has already been declared
147+
```
148+
So, we declare a variable once, and then should refer to it without `let`.
149+
````
150+
151151
```smart header="Functional languages"
152152
It's interesting to note that there exist [functional](https://en.wikipedia.org/wiki/Functional_programming) programming languages, like [Scala](http://www.scala-lang.org/) or [Erlang](http://www.erlang.org/) that forbid changing variable values.
153153

0 commit comments

Comments
 (0)