πŸ“Š Machine Learning
Q. What can be done in order to avoid creation of global variables in JavaScript?
  • (A) To use a method that defines all the variables
  • (B) To use an object that has the reference to all the variables
  • (C) To use an object as its namespace
  • (D) To use global functions
πŸ’¬ Discuss
βœ… Correct Answer: (C) To use an object as its namespace

Explanation: 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).

Explanation by: Mr. Dubey
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).

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
156
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
89%
Success Rate