Suppose I have the following code:
function one() {
var $a;
two();
}
function two() {
// I want to modify $a in this function
// Unfortunately, I cannot pass $a as a function parameter
}
I want to be able to modify variable $a in function two(). If I place the GLOBAL keyword in front of the $a in function two(), can I modify it appropriately? In that case, what happens when function one() returns? Does $a get destroyed, or is it still "global"?
function one() {
var $a;
two();
}
function two() {
// I want to modify $a in this function
// Unfortunately, I cannot pass $a as a function parameter
}
I want to be able to modify variable $a in function two(). If I place the GLOBAL keyword in front of the $a in function two(), can I modify it appropriately? In that case, what happens when function one() returns? Does $a get destroyed, or is it still "global"?