Expert Developer JavaScript Question:
Download Questions PDF

What happens when you don't declare a variable in Javascript?

Expert JavaScript Developer Interview Question
Expert JavaScript Developer Interview Question

Answer:

If you don't explicitly declare a variable, you risk creating an implied global variable. This is a problem, as you will be unable to create multiple instances of that object, as each new instance will overwrite the data from the last.
In general, global variables should be used only in very specific situations and are typically not recommended, as they can lead to a lot of odd side effects that may be difficult to track down.

Download Expert JavaScript Developer Interview Questions And Answers PDF

Previous QuestionNext Question
How can I prevent others from reading/stealing my scripts or images?Can you use x === "object" to test if x is an object?