feat(curriculum): added a short explanation on ES6 for isNan lesson (#62592)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
Clarence Bakosi
2025-10-25 09:38:51 +05:30
committed by GitHub
co-authored by Huyen Nguyen
parent a8bbe93fa6
commit 79c06257ac
@@ -43,7 +43,7 @@ console.log(isNaN("blabla")); // true: "blabla" is not a number
As you can see, `isNaN()` first attempts to convert the parameter to a number. If it can't be converted, it returns `true`. This behavior can lead to some surprising results, especially when dealing with strings that can be coerced into numbers.
Due to these potential inconsistencies, ES6 introduced `Number.isNaN()`. This method does not attempt to convert the parameter to a number before testing. It only returns `true` if the value is exactly `NaN`:
Due to these potential inconsistencies, ES6 (the sixth edition of JavaScript, released in 2015) introduced `Number.isNaN()`. This method does not attempt to convert the parameter to a number before testing. It only returns `true` if the value is exactly `NaN`:
```js
console.log(Number.isNaN(NaN)); // true