BY Simmi Kava17 Mar 2021 Edit
Null and NaN

JavaScript Oddities - Null and NaN

console.log(typeof null) //object
console.log(null instanceof Object) //false

We all know that value null represents intentional absence of any object value. typeof would return a string, hence typeof null returns object. This is a historical bug (since the first version of JavaScript) and cannot be fixed.

But since null is absence of value, it implies it cannot be instance of anything, hence instanceof returns a false value.

Similarly,

console.log(typeof NaN) //Number
console.log(NaN === NaN) //false

NaN is a number from data type point of view. NaN is a special number as specified by IEEE format specification and is not JavaScript language specific. NaN is never equal to NaN, as each NaN is unique unknown number.

BY Simmi Kava
2 Likes1 Save
LikeCommentSave
LikeCommentSaveShare
2
Categories
General
YantraJS
Developer Guides
Tutorials
Web Atoms Updates

POPULAR POSTS
17 Mar 2021
LATEST ACTIVITY
Simmi Kava
commented this post.
Simmi Kava
liked this post.
Show more
ARCHIVES
2024
2023
2022
2021
TAGS
javascript (56)
developer (25)
javascriptdeveloper (16)
Xamarin.Forms (16)
Html (14)
typescript (12)
webatoms (12)
xamarin (11)
coding (10)
web-atoms (10)
arrays (9)
android (8)
javascript-developer (8)
csharp (7)
dotnet (7)
css (6)
update (6)
dotnet-standard (5)
function (5)
iOS (5)
methods (4)




Web Atoms: JSX (TSX + TypeScript) for Xamarin.Forms, Hot Reload Your App in Production Environment

PlaygroundSamples Repository