Skip to content

Commit 8c5851d

Browse files
nik-revmao-sz
andauthored
feat: improve clarity of suggestion
Co-authored-by: MaoShizhong <[email protected]>
1 parent 360078c commit 8c5851d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

14_contains/solution/contains-solution.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const contains = function(obj, searchValue) {
22
const values = Object.values(obj);
33

4-
// NaN !== NaN, so we would usually have to do an explicit check with Math.isNaN to test for it. However, Array.prototype.includes handles that for us
4+
// NaN === NaN evaluates to false (as per the IEEE 754 standard)
5+
// Normally, we would have to do an explicit Number.isNaN() check to compare NaN equality
6+
// However, Array.prototype.includes automatically handles this for us
57
if (values.includes(searchValue)) return true;
68

79
const nestedObjects = values.filter((value) => typeof value === 'object' && value !== null);

0 commit comments

Comments
 (0)