+ 2

Workaround and strategies for global level variables in javascript?

5th May 2018, 9:42 PM
Cristopher Pereira Moreira
Cristopher Pereira Moreira - avatar
2 Answers
+ 8
One workaround is to use classes with accessor methods. Use global objects instead such as const var useAgain = { EAT: true, READ: 7, MILK: "ok", }; access by: useAgain.MILK Or pass frequently used variables as method arguments.
5th May 2018, 9:53 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
+ 1
cool thanks
5th May 2018, 9:57 PM
Cristopher Pereira Moreira
Cristopher Pereira Moreira - avatar