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