From d3f544bea54ac412ed89826cb350fc7677b13ee2 Mon Sep 17 00:00:00 2001 From: Tomasz Magulski Date: Sun, 20 Mar 2016 18:04:42 +0100 Subject: [PATCH] Fixing note about passing this to findIndex(). find() has exactly the same note above. --- es6 & beyond/ch6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/es6 & beyond/ch6.md b/es6 & beyond/ch6.md index 14f89e48f..6d37d3f51 100644 --- a/es6 & beyond/ch6.md +++ b/es6 & beyond/ch6.md @@ -368,7 +368,7 @@ points.findIndex( function matcher(point) { Don't use `findIndex(..) != -1` (the way it's always been done with `indexOf(..)`) to get a boolean from the search, because `some(..)` already yields the `true`/`false` you want. And don't do `a[ a.findIndex(..) ]` to get the matched value, because that's what `find(..)` accomplishes. And finally, use `indexOf(..)` if you need the index of a strict match, or `findIndex(..)` if you need the index of a more customized match. -**Note:** As with other array methods that take callbacks, `find(..)` takes an optional second argument that if set will specify the `this` binding for the callback passed as the first argument. Otherwise, `this` will be `undefined`. +**Note:** As with other array methods that take callbacks, `findIndex(..)` takes an optional second argument that if set will specify the `this` binding for the callback passed as the first argument. Otherwise, `this` will be `undefined`. ### `entries()`, `values()`, `keys()` Prototype Methods