typeof console === "object" is better than typeof console !== "null" which is always true.