0
Are Function Parameters Global?
If a variable is stored as a function parameter, can it be accessed outside of the function?
6 odpowiedzi
+ 8
Make X a global var like:
var x;
function() {
x = ....
}
+ 5
Can you show me an example of what you mean/need??
+ 3
No, you can have a different variable with the same name on the outter scope though...
0
so I can make a var inside function assign to parameter, and then it is accessible?
0
how to connect x to speed
function gasPedal() {
var x = null//pedal "depth"
}
function car(make,model,speed,etc){
if (gasPedal) {
speed += x
}
}
0
sorry, very rough, quick draft