diff --git a/README.md b/README.md index 64dc81117..2304d2f04 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ ### Array * [Array concatenation](#array-concatenation) * [Array difference](#array-difference) -* [Array includes](#array-includes) * [Array intersection](#array-intersection) * [Array remove](#array-remove) * [Array sample](#array-sample) @@ -153,19 +152,6 @@ const difference = (a, b) => { const s = new Set(b); return a.filter(x => !s.has [⬆ back to top](#table-of-contents) -### Array includes - -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 -``` - -[⬆ back to top](#table-of-contents) - ### Array intersection Create a `Set` from `b`, then use `Array.filter()` on `a` to only keep values contained in `b`. diff --git a/snippets/array-includes.md b/snippets/array-includes.md deleted file mode 100644 index 16fa578a5..000000000 --- a/snippets/array-includes.md +++ /dev/null @@ -1,11 +0,0 @@ -### Array includes - -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. - -In [ES6](http://www.ecma-international.org/ecma-262/7.0/#sec-array.prototype.includes), you can use a similar native `.includes()` function. -```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 -``` diff --git a/tag_database b/tag_database index 05dc761bd..bd508483b 100644 --- a/tag_database +++ b/tag_database @@ -2,7 +2,6 @@ anagrams-of-string-(with-duplicates):string array-concatenation:array array-difference:array -array-includes:array array-intersection:array array-remove:array array-sample:array