Question - What are undefined and undeclared variables in JavaScript?
Answer -
Variables that have been declared already but not initialized are known as undefined variables.
On the other hand, if a variable is being used in a program without being declared, then it is considered an undeclared variable.
Consider the following example:
var undefVar;
alert(undefVar); // undefined variable
alert(notDeclared); // accessing an undeclared variable