Skip to content

Commit 60ec589

Browse files
authored
Merge pull request #2179 from vsemozhetbyt/patch-5
Fix some possible typos and omissions in 1.5.5
2 parents 80efcda + 858ad69 commit 60ec589

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The syntax is:
4444
arr.splice(start[, deleteCount, elem1, ..., elemN])
4545
```
4646

47-
It modified `arr` starting from the index `start`: removes `deleteCount` elements and then inserts `elem1, ..., elemN` at their place. Returns the array of removed elements.
47+
It modifies `arr` starting from the index `start`: removes `deleteCount` elements and then inserts `elem1, ..., elemN` at their place. Returns the array of removed elements.
4848

4949
This method is easy to grasp by examples.
5050

@@ -700,7 +700,7 @@ alert(soldiers[1].age); // 23
700700

701701
If in the example above we used `users.filter(army.canJoin)`, then `army.canJoin` would be called as a standalone function, with `this=undefined`, thus leading to an instant error.
702702

703-
A call to `users.filter(army.canJoin, army)` can be replaced with `users.filter(user => army.canJoin(user))`, that does the same. The former is used more often, as it's a bit easier to understand for most people.
703+
A call to `users.filter(army.canJoin, army)` can be replaced with `users.filter(user => army.canJoin(user))`, that does the same. The latter is used more often, as it's a bit easier to understand for most people.
704704

705705
## Summary
706706

@@ -711,7 +711,7 @@ A cheat sheet of array methods:
711711
- `pop()` -- extracts an item from the end,
712712
- `shift()` -- extracts an item from the beginning,
713713
- `unshift(...items)` -- adds items to the beginning.
714-
- `splice(pos, deleteCount, ...items)` -- at index `pos` delete `deleteCount` elements and insert `items`.
714+
- `splice(pos, deleteCount, ...items)` -- at index `pos` deletes `deleteCount` elements and inserts `items`.
715715
- `slice(start, end)` -- creates a new array, copies elements from index `start` till `end` (not inclusive) into it.
716716
- `concat(...items)` -- returns a new array: copies all members of the current one and adds `items` to it. If any of `items` is an array, then its elements are taken.
717717

@@ -729,7 +729,7 @@ A cheat sheet of array methods:
729729
- `sort(func)` -- sorts the array in-place, then returns it.
730730
- `reverse()` -- reverses the array in-place, then returns it.
731731
- `split/join` -- convert a string to array and back.
732-
- `reduce(func, initial)` -- calculate a single value over the array by calling `func` for each element and passing an intermediate result between the calls.
732+
- `reduce/reduceRight(func, initial)` -- calculate a single value over the array by calling `func` for each element and passing an intermediate result between the calls.
733733

734734
- Additionally:
735735
- `Array.isArray(arr)` checks `arr` for being an array.
@@ -738,7 +738,7 @@ Please note that methods `sort`, `reverse` and `splice` modify the array itself.
738738

739739
These methods are the most used ones, they cover 99% of use cases. But there are few others:
740740

741-
- [arr.some(fn)](mdn:js/Array/some)/[arr.every(fn)](mdn:js/Array/every) checks the array.
741+
- [arr.some(fn)](mdn:js/Array/some)/[arr.every(fn)](mdn:js/Array/every) check the array.
742742

743743
The function `fn` is called on each element of the array similar to `map`. If any/all results are `true`, returns `true`, otherwise `false`.
744744

0 commit comments

Comments
 (0)