+ 1
how to make a local variable global javascript
plz answer, P.S. this is pure js
6 odpowiedzi
+ 3
Declare your variable outside the function once and then use it in function
var x;
function ak(){
x = your code goes here
}
+ 3
You can't make a variable global if it is declared inside functional scope.
You need to declare it in global scope and use inside functions.
//If you want us to fix problem for you, please link code.
+ 2
Sort by date.
https://www.sololearn.com/discuss/2074323/?ref=app
+ 1
Or else just dont use var to declare variable inside the function it will automatically become global.
0
plz answer!!! T-T
0
i tried it and didn't work