From be2699514a4a5d716eb21c8347a38a59d4bc0190 Mon Sep 17 00:00:00 2001 From: cpxPratik Date: Fri, 28 Jul 2017 15:08:42 +0545 Subject: [PATCH 1/5] Update article.md Fix typo. --- 1-js/02-first-steps/08-comparison/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/08-comparison/article.md b/1-js/02-first-steps/08-comparison/article.md index 7b6b91c5..df97ac5a 100644 --- a/1-js/02-first-steps/08-comparison/article.md +++ b/1-js/02-first-steps/08-comparison/article.md @@ -120,7 +120,7 @@ The same thing with an empty string: alert( '' == false ); // true ``` -That's because operands of different types are converted to a number by the assignment operator `=`. An empty string, just like `false`, becomes a zero. +That's because operands of different types are converted to a number by the equality operator `==`. An empty string, just like `false`, becomes a zero. What to do if we'd like to differentiate `0` from `false`? From 42fb5523298f640aee842f12214cdb9f76c59181 Mon Sep 17 00:00:00 2001 From: cpxPratik Date: Fri, 28 Jul 2017 15:33:11 +0545 Subject: [PATCH 2/5] Update article.md Fix typo --- 1-js/02-first-steps/09-alert-prompt-confirm/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/09-alert-prompt-confirm/article.md b/1-js/02-first-steps/09-alert-prompt-confirm/article.md index 17511f9c..c371643e 100644 --- a/1-js/02-first-steps/09-alert-prompt-confirm/article.md +++ b/1-js/02-first-steps/09-alert-prompt-confirm/article.md @@ -96,7 +96,7 @@ We covered 3 browser-specific functions to interact with the visitor: : shows a message. `prompt` -: shows a message asking the user to input text. It returns the text or, if CANCEL or `key:Esc` is clicked, all browsers except Safari return `null`. +: shows a message asking the user to input text. It returns the text or, if CANCEL or `key:Esc` is clicked, all browsers return `null`. `confirm` : shows a message and waits for the user to press "OK" or "CANCEL". It returns `true` for OK and `false` for CANCEL/`key:Esc`. From 70dfe976ff3591fd0496fb1b0b3c74874512666a Mon Sep 17 00:00:00 2001 From: cpxPratik Date: Fri, 28 Jul 2017 16:52:56 +0545 Subject: [PATCH 3/5] Update article.md --- 1-js/02-first-steps/10-ifelse/article.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/1-js/02-first-steps/10-ifelse/article.md b/1-js/02-first-steps/10-ifelse/article.md index a971c9da..ec4ebb49 100644 --- a/1-js/02-first-steps/10-ifelse/article.md +++ b/1-js/02-first-steps/10-ifelse/article.md @@ -1,14 +1,14 @@ # Conditional operators: if, '?' -Sometimes we need to perform different actions basing on a condition. +Sometimes we need to perform different actions based on a condition. -There's an `if` operator for that and also the "question mark" operator: `"?"` for conditional evaluation. +There is `if` statement for that and also the conditional (ternary) operator for conditional evaluation which we will be referring as “question mark” operator: "?" for simplicity. [cut] -## The "if" operator +## The "if" statement -The "if" operator gets a condition, evaluates it and -- if the result is `true` -- executes the code. +The "if" statement gets a condition, evaluates it and -- if the result is `true` -- executes the code. For example: @@ -22,7 +22,7 @@ if (year == 2015) alert( 'You are right!' ); In the example above, the condition is a simple equality check: `year == 2015`, but it can be much more complex. -If there's more than one command to execute -- we can use a code block in figure brackets: +If there is more than one command to execute -- we can use a code block in figure brackets: ```js if (year == 2015) { @@ -31,11 +31,11 @@ if (year == 2015) { } ``` -It is recommended to use figure brackets every time with `if`, even if there's only one command. That improves readability. +It is recommended to use figure brackets every time with `if`, even if there is only one command. That improves readability. ## Boolean conversion -The `if (…)` operator evaluates the expression in parentheses and converts it to the boolean type. +The `if (…)` statement evaluates the expression in parentheses and converts it to the boolean type. Let's recall the conversion rules from the chapter : @@ -70,7 +70,7 @@ if (cond) { ## The "else" clause -The `if` operator may contain an optional "else" block. It executes when the condition is wrong. +The `if` statement may contain an optional "else" block. It executes when the condition is wrong. For example: ```js run @@ -85,7 +85,7 @@ if (year == 2015) { ## Several conditions: "else if" -Sometimes we'd like to test several variants of a condition. There's an `else if` clause for that. +Sometimes we'd like to test several variants of a condition. There is an `else if` clause for that. For example: @@ -220,7 +220,7 @@ We don't assign a result to a variable here, the idea is to execute different co The notation seem to be shorter than `if`, that appeals to some programmers. But it is less readable. -Here's the same with `if` for comparison: +Here is the same with `if` for comparison: ```js run no-beautify let company = prompt('Which company created JavaScript?', ''); @@ -236,4 +236,4 @@ if (company == 'Netscape') { Our eyes scan the code vertically. The constructs which span several lines are easier to understand than a long horizontal instruction set. -The idea of a question mark `'?'` is to return one or another value depending on the condition. Please use it for exactly that. There's `if` to execute different branches of the code. +The idea of a question mark `'?'` is to return one or another value depending on the condition. Please use it for exactly that. There is `if` to execute different branches of the code. From 03da843d28d4a54ee340205130c26b7a7a645928 Mon Sep 17 00:00:00 2001 From: cpxPratik Date: Fri, 28 Jul 2017 16:55:21 +0545 Subject: [PATCH 4/5] Update article.md Fix typo --- 1-js/02-first-steps/10-ifelse/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/10-ifelse/article.md b/1-js/02-first-steps/10-ifelse/article.md index ec4ebb49..de65cdfb 100644 --- a/1-js/02-first-steps/10-ifelse/article.md +++ b/1-js/02-first-steps/10-ifelse/article.md @@ -2,7 +2,7 @@ Sometimes we need to perform different actions based on a condition. -There is `if` statement for that and also the conditional (ternary) operator for conditional evaluation which we will be referring as “question mark” operator: "?" for simplicity. +There is `if` statement for that and also the conditional (ternary) operator for conditional evaluation which we will be referring as “question mark” operator: `"?"` for simplicity. [cut] From ff1371f369816220059559e6fef6b30abbde0655 Mon Sep 17 00:00:00 2001 From: Nikolay Fedoseev Date: Fri, 28 Jul 2017 17:30:43 +0500 Subject: [PATCH 5/5] Fix typo --- .../07-object-oriented-programming/08-class-patterns/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/07-object-oriented-programming/08-class-patterns/article.md b/1-js/07-object-oriented-programming/08-class-patterns/article.md index 83c312a2..d548e20d 100644 --- a/1-js/07-object-oriented-programming/08-class-patterns/article.md +++ b/1-js/07-object-oriented-programming/08-class-patterns/article.md @@ -182,7 +182,7 @@ Right now they are fully independent. But we'd want `Rabbit` to extend `Animal`. In other words, rabbits should be based on animals, have access to methods of `Animal` and extend them with its own methods. -What does it mean in the language on prototypes? +What does it mean in the language of prototypes? Right now methods for `rabbit` objects are in `Rabbit.prototype`. We'd like `rabbit` to use `Animal.prototype` as a "fallback", if the method is not found in `Rabbit.prototype`.