commit
e833ecb02f
6 changed files with 6 additions and 6 deletions
|
@ -143,7 +143,7 @@ For example:
|
|||
let accessAllowed = (age > 18) ? true : false;
|
||||
```
|
||||
|
||||
Technically, we can omit parentheses around `age > 14`. The question mark operator has a low precedence. It executes after the comparison `>`, so that'll do the same:
|
||||
Technically, we can omit parentheses around `age > 18`. The question mark operator has a low precedence. It executes after the comparison `>`, so that'll do the same:
|
||||
|
||||
```js
|
||||
// the comparison operator "age > 18" executes first anyway
|
||||
|
|
|
@ -459,7 +459,7 @@ let message = "Hello!";
|
|||
let phrase = message;
|
||||
```
|
||||
|
||||
As a result we have two independant variables, each one is storing the string `"Hello!"`.
|
||||
As a result we have two independent variables, each one is storing the string `"Hello!"`.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ Unwanted elements of the array can also be thrown away via an extra comma:
|
|||
let [, , title] = ["Julius", "Caesar", "Consul", "of the Roman Republic"];
|
||||
*/!*
|
||||
|
||||
alert( title ); // Imperator
|
||||
alert( title ); // Consul
|
||||
```
|
||||
|
||||
In the code above, the first and second elements of the array are skipped, the third one is assigned to `title`, and the rest is also skipped.
|
||||
|
|
|
@ -319,7 +319,7 @@ class Article {
|
|||
|
||||
let article = Article.createTodays();
|
||||
|
||||
alert( articles.title ); // Todays digest
|
||||
alert( article.title ); // Todays digest
|
||||
```
|
||||
|
||||
Now every time we need to create a todays digest, we can call `Article.createTodays()`. Once again, that's not a method of an article, but a method of the whole class.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue