undefined is a primitive data type in javascript. When a variable is declared and not initialized or assigned a value, javascript by default assigns type undefined. method, function and statement can also return undefined.

propertyglobal object
scopeglobal

Variable not initialized or assigned a value

<script>
let a;
if(a === undefined)
   document.write("variable a is not initialized or assigned a value");
</script>