Wie greife ich in Javascript auf globale Variablen im Funktions-Hook zu?
Ich möchte die globale Variable 'x' in der folgenden Hook-Funktion verwenden.
var x = 10; //global variable
var oldA = a;
a = function a(param){
alert(x); //showing error: x is undefined
return oldA(param);
}
Wie behebe ich den Fehler?