Answers

Question and Answer:

  Home  Expert JavaScript Developer

⟩ What is difference between undefined variable and undeclared variable?

► 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>

 209 views

More Questions for you: