Skip to content

minor fixes #1890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 1-js/02-first-steps/11-logical-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ This leads to some interesting usage compared to a "pure, classical, boolean-onl

Another feature of OR `||` operator is the so-called "short-circuit" evaluation.

It means that `||` processes its arguments until the first truthy value is reached, and then the value is returned immediately, without even touching the other argument.
It means that `||` processes its arguments until the first truthy value is reached, and then the value is returned immediately, without even touching the other argument.

That importance of this feature becomes obvious if an operand isn't just a value, but an expression with a side effect, such as a variable assignment or a function call.

Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/01-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ alert( *!*key*/!* in user ); // true, property "age" exists

Why does the `in` operator exist? Isn't it enough to compare against `undefined`?

Well, most of the time the comparison with `undefined` works fine. But there's But there's a special case when it fails, but `"in"` works correctly.
Well, most of the time the comparison with `undefined` works fine. But there's a special case when it fails, but `"in"` works correctly.

It's when an object property exists, but stores `undefined`:

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/04-array/3-call-array-this/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ arr.push(function() {
alert( this );
})

arr[2](); // "a","b",function
arr[2](); // a,b,function(){...}
```

The array has 3 values: initially it had two, plus the function.
4 changes: 2 additions & 2 deletions 1-js/05-data-types/04-array/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ In computer science the data structure that allows this, is called [deque](https
`shift`
: Extracts the first element of the array and returns it:

```js
```js run
let fruits = ["Apple", "Orange", "Pear"];

alert( fruits.shift() ); // remove Apple and alert it
Expand All @@ -167,7 +167,7 @@ In computer science the data structure that allows this, is called [deque](https
`unshift`
: Add the element to the beginning of the array:

```js
```js run
let fruits = ["Orange", "Pear"];

fruits.unshift('Apple');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ But there's a subtle difference between `Array.from(obj)` and `[...obj]`:
So, for the task of turning something into an array, `Array.from` tends to be more universal.


## Get a new copy of an object/array
## Get a new copy of an array/object

Remember when we talked about `Object.assign()` [in the past](https://javascript.info/object#cloning-and-merging-object-assign)?

It is possible to do the same thing with the spread operator!
It is possible to do the same thing with the spread syntax.

```js run
let arr = [1, 2, 3];
Expand Down