Website Developer Question:

Tell me how Do You Distinguish Between An Undefined And Undeclared Variable?

Website Developer Interview Question
Website Developer Interview Question

Answer:

Undefined refers to a variable which has declaration but not initialized yet. However, an undeclared variable is one which has a reference in the code without being declared.

Example.

var iExistButUndefined;
alert(iExistButUndefined); // undefined
alert(iMNotDeclared); // accessing an undeclared variable


Previous QuestionNext Question
Tell me what is CORS? How does it work?Tell me what Is The Difference Between Undefined Value And Null Value?