From bebcbfa13449b0e48369eaa116091ceeb8053226 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 13 Jun 2022 23:49:14 +0200 Subject: [PATCH] minor fixes --- 1-js/05-data-types/05-array-methods/article.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1-js/05-data-types/05-array-methods/article.md b/1-js/05-data-types/05-array-methods/article.md index b3702bf3..985e4c99 100644 --- a/1-js/05-data-types/05-array-methods/article.md +++ b/1-js/05-data-types/05-array-methods/article.md @@ -260,14 +260,15 @@ Note that the methods use `===` comparison. So, if we look for `false`, it finds If we want to check for inclusion, and don't want to know the exact index, then `arr.includes` is preferred. -Also, a very minor difference of `includes` is that it correctly handles `NaN`, unlike `indexOf/lastIndexOf`: +Also, a minor, but noteworthy feature of `includes` is that it correctly handles `NaN`, unlike `indexOf/lastIndexOf`: ```js run const arr = [NaN]; -alert( arr.indexOf(NaN) ); // -1 (should be 0, but === equality doesn't work for NaN) +alert( arr.indexOf(NaN) ); // -1 (should be 0, but equality test === doesn't work for NaN) alert( arr.includes(NaN) );// true (correct) ``` + ### find and findIndex Imagine we have an array of objects. How do we find an object with the specific condition?