So, to avoid any error we should never assign undefined to a variable manually.
typeof undefined outputs: undefined
When comparing null with undefined remember to use === instead of ==, reason being
null == undefined returns true as it doesn't check for the type and performs type-conversion
null === undefined return false
typeof null is object and not null
(more details here)