When to Use typeof?
To check if a variable is defined before using it.
To validate function arguments.
To differentiate between primitive and reference types.
The typeof operator is a simple way to check the type of a value.
It is useful for debugging, type validation, and handling unexpected data.
Some special cases (like null returning "object") need extra caution.