For a declared variable use value === undefined; for a variable that might not exist at all use typeof value === "undefined".
let a;
a === undefined; // true
typeof notDeclaredAnywhere === "undefined"; // true, no ReferenceError
value == null; // true for both null and undefined
value ?? "fallback"; // use a default for null or undefinedReading an undeclared name throws a ReferenceError, but typeof is the one operator that is allowed to look at it safely. Reach for == null or the ?? operator when null and undefined should be treated the same.
