Merge pull request #5 from Kurczok/patch-1

Patch 1
This commit is contained in:
Kurczok 2017-07-09 11:33:22 +02:00 committed by GitHub
commit e833ecb02f
6 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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!"`.
![](variable-copy-value.png)

View file

@ -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.

View file

@ -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.

View file

@ -97,7 +97,7 @@ In other words, all special characters are allowed except where they mean someth
A dot `"."` inside square brackets means just a dot. The pattern `pattern:[.,]` would look for one of characters: either a dot or a comma.
In the example below the regexp `pattern:[-().^+]` looks for one of the characters `-().^`:
In the example below the regexp `pattern:[-().^+]` looks for one of the characters `-().^+`:
```js run
// No need to escape

View file

@ -96,7 +96,7 @@ let promise = new Promise(function(resolve, reject) {
The idea is that a job done by the executor may have only one result or an error. In programming, there exist other data structures that allow many "flowing" results, for instance streams and queues. They have their own advantages and disadvantages versus promises. They are not supported by JavaScript core and lack certain language features that promises provide, we don't cover them here to concentrate on promises.
Also we if we call `resolve/reject` with more then one argument -- only the first argument is used, the next ones are ignored.
Also if we call `resolve/reject` with more then one argument -- only the first argument is used, the next ones are ignored.
````
```smart header="Reject with `Error` objects"