
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Minimize the Use of Global Variables in JavaScript
A global variable has global scope which means it can be defined anywhere in your JavaScript code. To minimize the usage of global variables, use consistent variables around different parts of your project.
var myValue = { common: function(){ //Add code }, val1: { myVar1: "Demo String One", func1: function(){ //Add some code }, } val2: { myVar1: "Demo String Two", func1: function(){ //Add another code }, } val3: { myVar1: "Demo String Three", func1: function(){ //Add another code here } } };
Advertisements