The typeof null === "object" bug exists because early JavaScript represented null with the same bit pattern as objects. Fixing it would break existing code, so it remains.
To check for null, use strict equality:
if (value === null) {
// Handle null
}
Similarly, to distinguish arrays from objects, use Array.isArray(value) instead of typeof.