ExamVeda
Login
Home
This question belongs to Javascript Classes And Modules
Classes and Modules
?

What can be done in order to avoid creation of global variables in JavaScript?

Answer & Solution
Correct Answer: Option C
One way for a module to avoid the creation of global variables is to use an object as its namespace. Instead of defining global functions and variables, it stores the functions and values as properties of an object (which may be referenced to a global variable).
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.