diff --git a/1-js/01-getting-started/1-intro/article.md b/1-js/01-getting-started/1-intro/article.md index c6a19bc7..74521076 100644 --- a/1-js/01-getting-started/1-intro/article.md +++ b/1-js/01-getting-started/1-intro/article.md @@ -1,4 +1,4 @@ -# An introduction to JavaScript +# An Introduction to JavaScript Let's see what's so special about JavaScript, what we can achieve with it and which other technologies play well with it. diff --git a/1-js/02-first-steps/07-operators/article.md b/1-js/02-first-steps/07-operators/article.md index 14ac1ba9..f89bd594 100644 --- a/1-js/02-first-steps/07-operators/article.md +++ b/1-js/02-first-steps/07-operators/article.md @@ -201,7 +201,7 @@ Funny code, isn't it? We should understand how it works, because sometimes we ca ## Remainder % -The remainder operator `%` despite it's look does not have a relation to percents. +The remainder operator `%` despite its look does not have a relation to percents. The result of `a % b` is the remainder of the integer division of `a` by `b`. @@ -415,7 +415,7 @@ let a = (1+2, 3+4); alert( a ); // 7 (the result of 3+4) ``` -Here, the first expression `1+2` is evaluated, and it's result is thrown away, then `3+4` is evaluated and returned as the result. +Here, the first expression `1+2` is evaluated, and its result is thrown away, then `3+4` is evaluated and returned as the result. ```smart header="Comma has a very low precedence" Please note that the comma operator has very low precedence, lower than `=`, so parentheses are important in the example above. diff --git a/1-js/02-first-steps/13-switch/article.md b/1-js/02-first-steps/13-switch/article.md index 4ace9db8..b48ccfdf 100644 --- a/1-js/02-first-steps/13-switch/article.md +++ b/1-js/02-first-steps/13-switch/article.md @@ -155,6 +155,7 @@ switch (arg) { case '0': case '1': alert( 'One or zero' ); + break; case '2': alert( 'Two' ); @@ -162,7 +163,7 @@ switch (arg) { case 3: alert( 'Never executes!' ); - + break; default: alert( 'An unknown value' ) } diff --git a/1-js/04-object-basics/04-object-methods/article.md b/1-js/04-object-basics/04-object-methods/article.md index 0af2eddc..2edd3e6a 100644 --- a/1-js/04-object-basics/04-object-methods/article.md +++ b/1-js/04-object-basics/04-object-methods/article.md @@ -316,7 +316,7 @@ The result of a property access `user.hi` is not a function, but a value of Refe When parentheses `()` are called on the Reference Type, they receive the full information about the object and it's method, and can set the right `this` (`=user` in this case). -Any other operation like assignment `hi = user.hi` discards the reference type as a whole, takes the value of `user.hi` (a function) and passes it on. So any further operation "looses" `this`. +Any other operation like assignment `hi = user.hi` discards the reference type as a whole, takes the value of `user.hi` (a function) and passes it on. So any further operation "loses" `this`. So, as the result, the value of `this` is only passed the right way if the function is called directly using a dot `obj.method()` or square brackets `obj[method]()` syntax (they do the same here). diff --git a/1-js/04-object-basics/05-object-toprimitive/article.md b/1-js/04-object-basics/05-object-toprimitive/article.md index bd2fc771..bac33287 100644 --- a/1-js/04-object-basics/05-object-toprimitive/article.md +++ b/1-js/04-object-basics/05-object-toprimitive/article.md @@ -1,7 +1,7 @@ # Object to primitive conversion -What happens when objects are added `obj1 + obj2`, substracted `obj1 - obj2` or printed using `alert(obj)`? +What happens when objects are added `obj1 + obj2`, subtracted `obj1 - obj2` or printed using `alert(obj)`? There are special methods in objects that do the conversion. @@ -11,7 +11,7 @@ In the chapter we've seen the rules for numeric, string For objects, there's no to-boolean conversion, because all objects are `true` in a boolean context. So there are only string and numeric conversions. -The numeric conversion happens when we substract objects or apply mathematical functions. For instance, `Date` objects (to be covered in the chapter ) can be substracted, and the result of `date1 - date2` is the time difference between two dates. +The numeric conversion happens when we subtract objects or apply mathematical functions. For instance, `Date` objects (to be covered in the chapter ) can be subtracted, and the result of `date1 - date2` is the time difference between two dates. As for the string conversion -- it usually happens when we output an object like `alert(obj)` and in similar contexts. diff --git a/1-js/04-object-basics/06-constructor-new/article.md b/1-js/04-object-basics/06-constructor-new/article.md index b49de5cd..120cf4aa 100644 --- a/1-js/04-object-basics/06-constructor-new/article.md +++ b/1-js/04-object-basics/06-constructor-new/article.md @@ -162,16 +162,16 @@ alert( new SmallUser().name ); // John Usually constructors don't have a `return` statement. Here we mention the special behavior with returning objects mainly for the sake of completeness. -````smart header="Omitting brackets" -By the way, we can omit brackets after `new`, if it has no arguments: +````smart header="Omitting parentheses" +By the way, we can omit parentheses after `new`, if it has no arguments: ```js -let user = new User; // <-- no brackets +let user = new User; // <-- no parentheses // same as let user = new User(); ``` -Omitting brackets here is not considered a "good style", but the syntax is permitted by specification. +Omitting parentheses here is not considered a "good style", but the syntax is permitted by specification. ```` ## Methods in constructor diff --git a/1-js/05-data-types/04-array/article.md b/1-js/05-data-types/04-array/article.md index 635205dd..781699f7 100644 --- a/1-js/05-data-types/04-array/article.md +++ b/1-js/05-data-types/04-array/article.md @@ -4,7 +4,7 @@ Objects allow to store keyed collections of values. That's fine. But quite often we find that we need an *ordered collection*, where we have a 1st, a 2nd, a 3rd element and so on. For example, we need that to store a list of something: users, goods, HTML elements etc. -It not convenient to use an object here, because it provides no methods to manage the order of elements. We can’t insert a new property “between” the existing ones. Objects are just not meant for such use. +It is not convenient to use an object here, because it provides no methods to manage the order of elements. We can’t insert a new property “between” the existing ones. Objects are just not meant for such use. There exists a special data structure named `Array`, to store ordered collections.