Expert Developer JavaScript Question:
Download Questions PDF

What is difference between undefined variable and undeclared variable?

Expert JavaScript Developer Interview Question
Expert JavaScript Developer Interview Question

Answer:

► The variable which are declared in the program but not assigned any value yet is called undefined variable while the variable which are not declared in the program is called undeclared variable.
► For Example :
undeclared variable:
<script>
var p;
alert(p); // This will give error because p is undeclared variable.
</script>
? undefined variable
<script>
alert(p); //This will give error because p is undefined.
</script>

Download Expert JavaScript Developer Interview Questions And Answers PDF

Previous QuestionNext Question
How can I set up my own JavaScript error handler?What is escape() function?