From 3159e93bafff84c3e1618211279605e70d9ab94d Mon Sep 17 00:00:00 2001 From: Brent Guffens Date: Thu, 18 Jan 2018 16:44:55 +0100 Subject: [PATCH 1/5] Typo --- 1-js/02-first-steps/12-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/12-while-for/article.md b/1-js/02-first-steps/12-while-for/article.md index 95f01678..c1334cd7 100644 --- a/1-js/02-first-steps/12-while-for/article.md +++ b/1-js/02-first-steps/12-while-for/article.md @@ -35,7 +35,7 @@ A single execution of the loop body is called *an iteration*. The loop in the ex If there were no `i++` in the example above, the loop would repeat (in theory) forever. In practice, the browser provides ways to stop such loops, and for server-side JavaScript we can kill the process. -Any expression or a variable can be a loop condition, not just a comparison. They are evaluated and converted to boolean by `while`. +Any expression or a variable can be a loop condition, not just a comparison. They are evaluated and converted to a boolean by `while`. For instance, the shorter way to write `while (i != 0)` could be `while (i)`: From 3fbe7e08c2f8facf110b95f13f1378c9f869256c Mon Sep 17 00:00:00 2001 From: Brent Guffens Date: Thu, 18 Jan 2018 16:55:28 +0100 Subject: [PATCH 2/5] Typo --- 1-js/02-first-steps/12-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/12-while-for/article.md b/1-js/02-first-steps/12-while-for/article.md index c1334cd7..d1765279 100644 --- a/1-js/02-first-steps/12-while-for/article.md +++ b/1-js/02-first-steps/12-while-for/article.md @@ -229,7 +229,7 @@ while (true) { alert( 'Sum: ' + sum ); ``` -The `break` directive is activated in the line `(*)` if the user enters an empty line or cancels the input. It stops the loop immediately, passing the control to the first line after the loop. Namely, `alert`. +The `break` directive is activated at the line `(*)` if the user enters an empty line or cancels the input. It stops the loop immediately, passing the control to the first line after the loop. Namely, `alert`. The combination "infinite loop + `break` as needed" is great for situations when the condition must be checked not in the beginning/end of the loop, but in the middle, or even in several places of the body. From d5dffa961c614d01d5aa2a072476c075ee6054ea Mon Sep 17 00:00:00 2001 From: Brent Guffens Date: Thu, 18 Jan 2018 17:03:48 +0100 Subject: [PATCH 3/5] Clarification --- 1-js/02-first-steps/12-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/12-while-for/article.md b/1-js/02-first-steps/12-while-for/article.md index d1765279..229eda96 100644 --- a/1-js/02-first-steps/12-while-for/article.md +++ b/1-js/02-first-steps/12-while-for/article.md @@ -268,7 +268,7 @@ for (let i = 0; i < 10; i++) { From a technical point of view it's identical to the example above. Surely, we can just wrap the code in the `if` block instead of `continue`. -But as a side-effect we got one more figure brackets nesting level. If the code inside `if` is longer than a few lines, that may decrease the overall readability. +But as a side-effect we got one more nesting level (the `alert` call inside the curly braces). If the code inside `if` is longer than a few lines, that may decrease the overall readability. ```` ````warn header="No `break/continue` to the right side of '?'" From f90111cb4d62b57607afabbef3afa65c6431edb3 Mon Sep 17 00:00:00 2001 From: Brent Guffens Date: Thu, 18 Jan 2018 17:15:18 +0100 Subject: [PATCH 4/5] More clarifications --- 1-js/02-first-steps/12-while-for/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/02-first-steps/12-while-for/article.md b/1-js/02-first-steps/12-while-for/article.md index 229eda96..e8bd3e5b 100644 --- a/1-js/02-first-steps/12-while-for/article.md +++ b/1-js/02-first-steps/12-while-for/article.md @@ -272,7 +272,7 @@ But as a side-effect we got one more nesting level (the `alert` call inside the ```` ````warn header="No `break/continue` to the right side of '?'" -Please note that syntax constructs that are not expressions cannot be used in `'?'`. In particular, directives `break/continue` are disallowed there. +Please note that syntax constructs that are not expressions cannot be used with the ternary operator `?`. In particular, directives such as `break/continue` are disallowed there. For example, if we take this code: @@ -294,7 +294,7 @@ if (i > 5) { ...Then it stops working. The code like this will give a syntax error: -That's just another reason not to use a question mark operator `'?'` instead of `if`. +That's just another reason not to use a question mark operator `?` instead of `if`. ```` ## Labels for break/continue From 07616285d4fca16a87f05889e4d3629645fe716a Mon Sep 17 00:00:00 2001 From: Brent Guffens Date: Thu, 18 Jan 2018 17:15:41 +0100 Subject: [PATCH 5/5] Typo --- 1-js/02-first-steps/12-while-for/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/12-while-for/article.md b/1-js/02-first-steps/12-while-for/article.md index e8bd3e5b..70630459 100644 --- a/1-js/02-first-steps/12-while-for/article.md +++ b/1-js/02-first-steps/12-while-for/article.md @@ -387,4 +387,4 @@ To make an "infinite" loop, usually the `while(true)` construct is used. Such a If we don't want to do anything on the current iteration and would like to forward to the next one, the `continue` directive does it. -`Break/continue` support labels before the loop. A label is the only way for `break/continue` to escape the nesting and go to the outer loop. +`break/continue` support labels before the loop. A label is the only way for `break/continue` to escape the nesting and go to the outer loop.