How I can to change local variables into global variables in JavaScript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I can to change local variables into global variables in JavaScript?

14th Sep 2022, 2:29 PM
Ezat Ullah Ghafoori
Ezat Ullah Ghafoori - avatar
3 Answers
+ 5
By defining them at a global level. Do you have an example code that illustrates the problem? Please link it.
14th Sep 2022, 2:33 PM
Lisa
Lisa - avatar
+ 3
use window.variableName=value maybe ...
14th Sep 2022, 2:53 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 3
or declaring a variable without using const, let or var will make it global
14th Sep 2022, 3:14 PM
Sandeep
Sandeep - avatar