Skip to content

Commit 2ca9d97

Browse files
authored
Merge pull request #1072 from K-Sato1995/patch-3
Fix typos
2 parents 382d4e5 + f6b9d22 commit 2ca9d97

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ alert(arr); // *!*1, 2, 15*/!*
418418

419419
Now it works as intended.
420420

421-
Let's step aside and think what's happening. The `arr` can be array of anything, right? It may contain numbers or strings or html elements or whatever. We have a set of *something*. To sort it, we need an *ordering function* that knows how to compare its elements. The default is a string order.
421+
Let's step aside and think what's happening. The `arr` can be array of anything, right? It may contain numbers or strings or HTML elements or whatever. We have a set of *something*. To sort it, we need an *ordering function* that knows how to compare its elements. The default is a string order.
422422

423423
The `arr.sort(fn)` method has a built-in implementation of sorting algorithm. We don't need to care how it exactly works (an optimized [quicksort](https://en.wikipedia.org/wiki/Quicksort) most of the time). It will walk the array, compare its elements using the provided function and reorder them, all we need is to provide the `fn` which does the comparison.
424424

@@ -474,7 +474,7 @@ It also returns the array `arr` after the reversal.
474474

475475
### split and join
476476

477-
Here's the situation from the real life. We are writing a messaging app, and the person enters the comma-delimited list of receivers: `John, Pete, Mary`. But for us an array of names would be much more comfortable than a single string. How to get it?
477+
Here's the situation from real life. We are writing a messaging app, and the person enters the comma-delimited list of receivers: `John, Pete, Mary`. But for us an array of names would be much more comfortable than a single string. How to get it?
478478

479479
The [str.split(delim)](mdn:js/String/split) method does exactly that. It splits the string into an array by the given delimiter `delim`.
480480

@@ -548,7 +548,7 @@ So far, like `forEach/map`. But there's one more argument:
548548

549549
The easiest way to grasp that is by example.
550550

551-
Here we get a sum of array in one line:
551+
Here we get a sum of an array in one line:
552552

553553
```js run
554554
let arr = [1, 2, 3, 4, 5];
@@ -681,7 +681,7 @@ In the call above, we use `user.younger` as a filter and also provide `user` as
681681

682682
## Summary
683683

684-
A cheatsheet of array methods:
684+
A cheat sheet of array methods:
685685

686686
- To add/remove elements:
687687
- `push(...items)` -- adds items to the end,
@@ -727,6 +727,6 @@ For the full list, see the [manual](mdn:js/Array).
727727

728728
From the first sight it may seem that there are so many methods, quite difficult to remember. But actually that's much easier than it seems.
729729

730-
Look through the cheatsheet just to be aware of them. Then solve the tasks of this chapter to practice, so that you have experience with array methods.
730+
Look through the cheat sheet just to be aware of them. Then solve the tasks of this chapter to practice, so that you have experience with array methods.
731731

732-
Afterwards whenever you need to do something with an array, and you don't know how -- come here, look at the cheatsheet and find the right method. Examples will help you to write it correctly. Soon you'll automatically remember the methods, without specific efforts from your side.
732+
Afterwards whenever you need to do something with an array, and you don't know how -- come here, look at the cheat sheet and find the right method. Examples will help you to write it correctly. Soon you'll automatically remember the methods, without specific efforts from your side.

0 commit comments

Comments
 (0)