From 9cb597e22938cccfc02a271da760edc9d39eb149 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 1 Jun 2020 09:46:43 +0300 Subject: [PATCH] minor fixes --- 1-js/02-first-steps/04-variables/article.md | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/1-js/02-first-steps/04-variables/article.md b/1-js/02-first-steps/04-variables/article.md index 3716e884..a8d131c9 100644 --- a/1-js/02-first-steps/04-variables/article.md +++ b/1-js/02-first-steps/04-variables/article.md @@ -80,20 +80,6 @@ let user = 'John' Technically, all these variants do the same thing. So, it's a matter of personal taste and aesthetics. -````warn header="Declaring twice triggers an error" -A variable should be declared only once. - -A repeated declaration of the same variable is an error: - -```js run -let message = "This"; - -// repeated 'let' leads to an error -let message = "That"; // SyntaxError: 'message' has already been declared -``` -So, we declare a variable once, and then should refer to it without `let`. -```` - ````smart header="`var` instead of `let`" In older scripts, you may also find another keyword: `var` instead of `let`: @@ -148,6 +134,20 @@ alert(hello); // Hello world! alert(message); // Hello world! ``` +````warn header="Declaring twice triggers an error" +A variable should be declared only once. + +A repeated declaration of the same variable is an error: + +```js run +let message = "This"; + +// repeated 'let' leads to an error +let message = "That"; // SyntaxError: 'message' has already been declared +``` +So, we declare a variable once, and then should refer to it without `let`. +```` + ```smart header="Functional languages" 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.