Skip to content

Commit df3260a

Browse files
committed
fixes
1 parent 9f010c6 commit df3260a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ true + false = 1
1414
" -9 " - 5 = -14 // (4)
1515
null + 1 = 1 // (5)
1616
undefined + 1 = NaN // (6)
17+
" \t \n" - 2 = -2 // (7)
1718
```
1819

1920
1. The addition with a string `"" + 1` converts `1` to a string: `"" + 1 = "1"`, and then we have `"1" + 0`, the same rule is applied.
@@ -22,3 +23,4 @@ undefined + 1 = NaN // (6)
2223
4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).
2324
5. `null` becomes `0` after the numeric conversion.
2425
6. `undefined` becomes `NaN` after the numeric conversion.
26+
7. Space characters, such as `\t` and `\n`, are trimmed off string start and end when a string is converted to a number. So a string `\t \n`, similarly to an empty string, becomes `0`.

1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/task.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ true + false
2121
" -9 " - 5
2222
null + 1
2323
undefined + 1
24+
" \t \n" - 2
2425
```
2526

2627
Think well, write down and then compare with the answer.

1-js/05-data-types/05-array-methods/article.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ The method [arr.slice](mdn:js/Array/slice) is much simpler than similar-looking
119119
The syntax is:
120120

121121
```js
122-
arr.slice(start, end)
122+
arr.slice([start], [end])
123123
```
124124

125125
It returns a new array copying to it all items from index `start` to `end` (not including `end`). Both `start` and `end` can be negative, in that case position from array end is assumed.
@@ -136,6 +136,8 @@ alert( arr.slice(1, 3) ); // e,s (copy from 1 to 3)
136136
alert( arr.slice(-2) ); // s,t (copy from -2 till the end)
137137
```
138138

139+
We can also call it without arguments: `arr.slice()` creates a copy of `arr`. That's often used to obtain a copy for further transformations that should not affect the original array.
140+
139141
### concat
140142

141143
The method [arr.concat](mdn:js/Array/concat) creates a new array that includes values from other arrays and additional items.

0 commit comments

Comments
 (0)