// man come on
typeof null === "object";i keep forgetting about this one. fortunately there's nothing loadbearing that relies on this type of check but man come on

// man come on
typeof null === "object";i keep forgetting about this one. fortunately there's nothing loadbearing that relies on this type of check but man come on
i love js/ts

"wanna know the type of something? use typeof! (except when typeof doesnt return the type of your variable)"
So all of the numeric types have a typeof "number" except for the only numeric type that obeys all the rules of standard arithmetic. Got it.
all of the numeric types
im sorry that i have to be the bearer of bad news but there is exactly one numeric type - number - in js
Wew, I think they mean bigint. Also, of course:
> 10n instanceof Number
false
BigInts aren't numbers, because a number, as u know, is a 64-bit Float only and nothing else, meowf.
typeof always returns the primitive type of a value. the reason Array.isArray is a thing is because arrays are objects and not a primitive type. Array.isArray(a) is basically equivalent to a instanceof Array (except it also returns true for arrays from other frames which are an instance of that frame's Array object, not yours (iirc))
oh yeah. it's the only exception tho (i think?) and afaik there's no other reliable way to check if an object is callable.
Trying to think of any situation where null not being its own separate type is helpful, meowf. Teh only ones I can think of are specific conveniences in statically typed languages, which don'f apply to javascript...
U can't type infer null in java, so maybe they just copied c's void* instead (even tho even c now has a separate type fur its nullptr now in c23, nullptr_t)
apparently it was an accident which people relied on so it can't be fixed without breaking the web (https://2ality.com/2013/10/typeof-null.html)
I love the various footguns javascript gives you. Makes everything feel more homely, you know? Like a slightly messed up green bean casserole made in a rush.