3 ms·
My personal approach is to pretend the distinction doesn't exist by writing my code as if it doesn't exist. Mostly this means using "foo == null", which works f
by brundolf 6y ago
My personal approach is to pretend the distinction doesn't exist by writing my code as if it doesn't exist. Mostly this means using "foo == null", which works for both. Using undefined as a default convention is well and good, but trying to get to a place where you can guarantee it across a whole project is folly. I've personally seen the JSON case, in particular, result in some fairly pointless extra complexity converting all nulls to undefineds.