Tag, lint, build

This commit is contained in:
Angelos Chalaris
2017-12-15 13:06:53 +02:00
parent 7b43ca82ae
commit e8293d89de
3 changed files with 18 additions and 3 deletions

View File

@ -1,10 +1,10 @@
### Array includes
Use `slice()` to offset the array/string. `Array.indexOf()` returns `-1` if the sub-string/array dosen't contain the given `value`.
Use `slice()` to offset the array/string and `indexOf()` to check if the value is included.
Omit the last argument, `fromIndex`, to check the whole array/string.
```js
const includes = (collection, val, fromIndex=0) => collection.slice(fromIndex).indexOf(val) != -1;
// includes("30-seconds-of-code", "code") -> true
// includes([1, 2, 3, 4], [1, 2], 1) -> false
```
```