What is "undefined"
A variable is undefined if it has not been assigned a value.
Depending on the programming language in question, undefined
may be a real value or a default value may have been set to "" (an empty string), 0 or NULL anyway.
Access to the indefinite variable may result in some kind of error condition.
Useful links
We have questions here that we can consider as canonical and reading them will learn a lot of what you need to solve your problem:
- How to check Undefined correctly in Javascript
- (reserved for the community to add)