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
Shubham Khare
liked this post.
Simmi Kava
liked this post.
Show more
ARCHIVES
2022
2021
2020
2019
TAGS
javascript (54)
developer (25)
javascriptdeveloper (16)
Xamarin.Forms (16)
webatoms (12)
typescript (11)
xamarin (11)
coding (10)
Html (10)
arrays (9)
android (8)
web-atoms (8)
csharp (7)
dotnet (7)
javascript-developer (6)
update (6)
dotnet-standard (5)
function (5)
iOS (5)
css (4)
methods (4)




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

PlaygroundSamples Repository