3 ms·
> What’s nothing? I know the == operator drives people crazy sometimes, and you are told to use === but if you actually understands what == does it's a conveni
by z3t4 9y ago
> What’s nothing?
I know the == operator drives people crazy sometimes, and you are told to use === but if you actually understands what == does it's a convenience that null==undefined so you don't have to type if(foo == null || foo == undefined).
You could argue that having two (or with false it's three) types of "nothing" is confusing, but for me they mean different things. undefined means it has not been defined, null means it explicitly "nothing" and false means it's "not true". And for convenience you can write if(foo) to check for them all.