Skip to content

Commit 0c8da42

Browse files
committed
-1 is returned by findIndex() method when nothing is found.
1 parent f2e27fd commit 0c8da42

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1-js/05-data-types/05-array-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ In real life arrays of objects is a common thing, so the `find` method is very u
305305

306306
Note that in the example we provide to `find` the function `item => item.id == 1` with one argument. Other arguments of this function are rarely used.
307307

308-
The [arr.findIndex](mdn:js/Array/findIndex) method is essentially the same, but it returns the index where the element was found instead of the element itself.
308+
The [arr.findIndex](mdn:js/Array/findIndex) method is essentially the same, but it returns the index where the element was found instead of the element itself and returns `-1` when nothing is found.
309309

310310
### filter
311311

0 commit comments

Comments
 (0)