Skip to content

Commit ccc0e93

Browse files
committed
2 parents 82583be + 24411a8 commit ccc0e93

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

1-js/05-data-types/03-string/article.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let double = "double-quoted";
1919
let backticks = `backticks`;
2020
```
2121

22-
Single and double quotes are essentially the same. Backticks however allow us to embed any expression into the string, including function calls:
22+
Single and double quotes are essentially the same. Backticks, however, allow us to embed any expression into the string, including function calls:
2323

2424
```js run
2525
function sum(a, b) {
@@ -89,7 +89,7 @@ Examples with unicode:
8989
```js run
9090
alert( "\u00A9" ); // ©
9191
alert( "\u{20331}" ); // 佫, a rare chinese hieroglyph (long unicode)
92-
alert( "\u{1F60D}"); // 😍, a smiling face symbol (another long unicode)
92+
alert( "\u{1F60D}" ); // 😍, a smiling face symbol (another long unicode)
9393
```
9494

9595
All special characters start with a backslash character `\`. It is also called an "escape character".
@@ -166,7 +166,7 @@ alert( str.charAt(1000) ); // '' (an empty string)
166166
We can also iterate over characters using `for..of`:
167167

168168
```js run
169-
for(let char of "Hello") {
169+
for (let char of "Hello") {
170170
alert(char); // H,e,l,l,o (char becomes "H", then "e", then "l" etc)
171171
}
172172
```
@@ -379,8 +379,8 @@ There are 3 methods in JavaScript to get a substring: `substring`, `substr` and
379379

380380
```js run
381381
let str = "stringify";
382-
alert( str.slice(0,5) ); // 'strin', the substring from 0 to 5 (not including 5)
383-
alert( str.slice(0,1) ); // 's', from 0 to 1, but not including 1, so only character at 0
382+
alert( str.slice(0, 5) ); // 'strin', the substring from 0 to 5 (not including 5)
383+
alert( str.slice(0, 1) ); // 's', from 0 to 1, but not including 1, so only character at 0
384384
```
385385

386386
If there is no second argument, then `slice` goes till the end of the string:
@@ -548,7 +548,7 @@ For instance:
548548
alert( 'Österreich'.localeCompare('Zealand') ); // -1
549549
```
550550

551-
This method actually has two additional arguments specified in [the documentation](mdn:js/String/localeCompare), which allow it to specify the language (by default taken from the environment) and setup additional rules like case sensivity or should `"a"` and `"á"` be treated as the same etc.
551+
This method actually has two additional arguments specified in [the documentation](mdn:js/String/localeCompare), which allows it to specify the language (by default taken from the environment) and setup additional rules like case sensitivity or should `"a"` and `"á"` be treated as the same etc.
552552

553553
## Internals, Unicode
554554

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ But for arrays there is another form of loop, `for..of`:
297297
let fruits = ["Apple", "Orange", "Plum"];
298298

299299
// iterates over array elements
300-
for(let fruit of fruits) {
300+
for (let fruit of fruits) {
301301
alert( fruit );
302302
}
303303
```
@@ -356,7 +356,7 @@ arr.length = 5; // return length back
356356
alert( arr[3] ); // undefined: the values do not return
357357
```
358358

359-
So, the simplest way to clear the array is: `arr.length=0`.
359+
So, the simplest way to clear the array is: `arr.length = 0;`.
360360

361361

362362
## new Array() [#new-array]
@@ -385,9 +385,9 @@ In the code above, `new Array(number)` has all elements `undefined`.
385385

386386
To evade such surprises, we usually use square brackets, unless we really know what we're doing.
387387

388-
## Multidimentional arrays
388+
## Multidimensional arrays
389389

390-
Arrays can have items that are also arrays. We can use it for multidimentional arrays, to store matrices:
390+
Arrays can have items that are also arrays. We can use it for multidimensional arrays, to store matrices:
391391

392392
```js run
393393
let matrix = [
@@ -458,9 +458,9 @@ We can use an array as a deque with the following operations:
458458
- `unshift(...items)` adds items to the beginning.
459459

460460
To loop over the elements of the array:
461-
- `for(let i=0; i<arr.length; i++)` -- works fastest, old-browser-compatible.
462-
- `for(let item of arr)` -- the modern syntax for items only,
463-
- `for(let i in arr)` -- never use.
461+
- `for (let i=0; i<arr.length; i++)` -- works fastest, old-browser-compatible.
462+
- `for (let item of arr)` -- the modern syntax for items only,
463+
- `for (let i in arr)` -- never use.
464464

465465
We will return to arrays and study more methods to add, remove, extract elements and sort arrays in the chapter <info:array-methods>.
466466

1-js/06-advanced-functions/08-settimeout-setinterval/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Then the next call is scheduled in `(*)` if we're not done yet.
325325

326326
Pauses between `count` executions provide just enough "breath" for the JavaScript engine to do something else, to react on other user actions.
327327

328-
The notable thing is that both variants: with and without splitting the job by `setInterval` -- are comparable in speed. There's no much difference in the overall counting time.
328+
The notable thing is that both variants: with and without splitting the job by `setTimeout` -- are comparable in speed. There's no much difference in the overall counting time.
329329

330330
To make them closer let's make an improvement.
331331

@@ -461,4 +461,4 @@ For example, the in-browser timer may slow down for a lot of reasons:
461461
- The browser tab is in the background mode.
462462
- The laptop is on battery.
463463

464-
All that may decrease the minimal timer resolution (the minimal delay) to 300ms or even 1000ms depending on the browser and settings.
464+
All that may increase the minimal timer resolution (the minimal delay) to 300ms or even 1000ms depending on the browser and settings.

0 commit comments

Comments
 (0)