What are undeclared and undefined variables?



What are undeclared and undefined variables?..

Answer / Sudhir Kumar Tiwari

Undeclared variables are variables that have not been declared with the var, let, or const keyword. They will automatically create a global variable if they are used outside of a function, but will cause a ReferenceError within a function. On the other hand, undefined variables are declared but have not been assigned any value. They will return undefined when accessed and do not throw an error.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

What is null javascript?

1 Answers  


How do I turn on javascript in google chrome?

1 Answers  


How to trigger a postback on an updatepanel from javascript?

1 Answers  


Can you call a Java Applet using a JavaScript function?

2 Answers   HCL, Satyam,


What is a method in javascript?

1 Answers  


Is javascript free to use?

1 Answers  


hello sir my name is naga sekhar i completed my b-tech in 2011 with 61% in IT streme.I completed my core and advanced java coure before 8months back.Still i did not get the job.i tried so many times.and i went to some interviews but no use.now i want to get the job in software sector

1 Answers  


How long does it take to get good at javascript?

1 Answers  


What is jscript used for?

1 Answers  


What is node value?

1 Answers  


What is called variable typing in javascript?

1 Answers  


Some XYZ company is arranging for online aptitude tests. Draw detailed E-R diagram for the same..

1 Answers   QuinStreet,


Categories