From 67f9684f800fcdfe407eee938d233bb1a22bce52 Mon Sep 17 00:00:00 2001 From: iamsoorena Date: Fri, 15 Dec 2017 23:16:18 +0330 Subject: [PATCH] add description to array includes snippet since it looks a lot like es6 native includes function. --- snippets/array-includes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/snippets/array-includes.md b/snippets/array-includes.md index 5ebcbc009..16fa578a5 100644 --- a/snippets/array-includes.md +++ b/snippets/array-includes.md @@ -3,6 +3,7 @@ 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