DEV Community

Discussion on: Pragmatic types: types vs null

Collapse
 
stereobooster profile image
stereobooster

Not sure I get your argument. Variables exist in both cases, but they have no value. (I know that from machine point of view they have two distinct values JSVAL_NULL and JSVAL_VOID)

And this is what null is for - to represent absence of value. We have variable, but it doesn't hold any value. If you want to read more about historical reasons why JS have both null and undefined you can read this post by Dr. Axel Rauschmayer