But a lot of js developers expect a null. A lot of libs return null (some even return either, with no reason for one or the other). And js itself also returns null, for example getElementById.
The reason I use it is that if you see a null you known that it was explicitly set, where as undefined means it hasn't been touched.
Would you recommend just sticking to undefined rather than mixing null and undefined?
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.