Merge pull request #8 from DannyFeliz/master
Replace the usage of ìndexOf` for `includes`
This commit is contained in:
@ -110,11 +110,11 @@ var curry = f =>
|
|||||||
|
|
||||||
### Difference between arrays
|
### Difference between arrays
|
||||||
|
|
||||||
Use `filter()` to remove values that are part of `values`, determined using `indexOf()`.
|
Use `filter()` to remove values that are part of `values`, determined using `includes()`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var difference = (arr, values) =>
|
var difference = (arr, values) =>
|
||||||
arr.filter(v => values.indexOf(v) === -1);
|
arr.filter(v => !values.includes(v));
|
||||||
```
|
```
|
||||||
|
|
||||||
### Distance between two points
|
### Distance between two points
|
||||||
@ -324,11 +324,11 @@ var scrollToTop = _ => {
|
|||||||
|
|
||||||
### Similarity between arrays
|
### Similarity between arrays
|
||||||
|
|
||||||
Use `filter()` to remove values that are not part of `values`, determined using `indexOf()`.
|
Use `filter()` to remove values that are not part of `values`, determined using `includes()`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var difference = (arr, values) =>
|
var difference = (arr, values) =>
|
||||||
arr.filter(v => values.indexOf(v) !== -1);
|
arr.filter(v => values.includes(v));
|
||||||
```
|
```
|
||||||
|
|
||||||
### Sort characters in string (alphabetical)
|
### Sort characters in string (alphabetical)
|
||||||
@ -367,6 +367,7 @@ var tail = arr => arr.slice(1);
|
|||||||
|
|
||||||
### Unique values of array
|
### Unique values of array
|
||||||
|
|
||||||
|
|
||||||
Use ES6 `Set` and the `...rest` operator to discard all duplicated values.
|
Use ES6 `Set` and the `...rest` operator to discard all duplicated values.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user