What is undefined in js ? | JavaScript

The undefined property indicates that a variable has not been assigned a value, or not declared at all .

let num;
if (typeof num === "undefined") {
 console.log("num is undefined");
} else {
 console.log("num is defined");
}

2 Likes