Basic JavaScript Question:

What are undefined and undeclared variables?

Tweet Share WhatsApp

Answer:

Undeclared variables are those that are not declared in the program (do not exist at all), trying to read their values gives runtime error. But if undeclared variables are assigned then implicit declaration is done .
Undefined variables are those that are not assigned any value but are declared in the program. Trying to read such variables gives special value called undefined value.

Download JavaScript PDF Read All 114 JavaScript Questions
Previous QuestionNext Question
Does JavaScript have the concept level scope? What is === operator?