Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
olback107947yEverything in js is an object. Even if typeof says otherwise.
NaN == NaN : false
typeof NaN : Number // NaN = "Not a Number" -
Oh ffs. Not this again.
Everything in js is an object.
Null is a valueless object. It's where an object exists and is known to have no value.
If you want a value that denotes emptyness without being an object, use "undefined".
Null is supposed to be an object and there's nothing surprising about typeof returning that because that's what JavaScript, which we all know is dynamically typed, is designed to do.
Js has plenty of faults but null and undefined work just fine if you know where to use which. -
@hashedram amen.
I'm also tiered of hearing the same over and over, If people would invest the time in a "why" question instead of going "haha lets make jokes about it" they would find the awnser immidiently. And that it is not JS specific in most cases.
Also NaN is a NumberType for example sqrt(-1) Resultat in a number but It is not representable in real number. And in JS and other languages this results in NaNs. -
tizo5647yI mean most things in JavaScript are objects. Even primitives have object wrappers to allow methods on the primitives. Even a function is a first class object in JS. Embrace the flexibility it gives you.
Related Rants
-
codepoet29Ever wondered where did ಠ_ಠ come from? It's from my native language called Kannada. ಠ is pronounced as T...
-
writeascript14me: *reads java book on phone* guy next to me: *looking at my screen* you're a hacker, right? ಠ_ಠ
-
Minnow9When you have to help a fellow CS student install the JDK but they’ve downloaded the JRE instead
Dear javascript.
Kindly go fuck yourself sideways.
typeof null === "object"
rant
ಠ_ಠ