Actually, it's better to show the code, how can you make it work?
function Test(){ alert(myVar); } function Main(myFunct){ var myVar = 123; // Все объявленные переменные должны перебраться в область видимости переданной функции. В PHP, например, это делается с помощью extract() myFunct(); } Main(Test); // Передаем в Main некую функцию
The fact is that now I have to do something like this:
function Test(args){ alert(args.tmyVart) } function Main(){ Test({myVar: 123}) } Main();
This greatly reduces the readability of the code when args.
are everywhere args.
myVar
? The code is probably a typo, because in the function Main -myVar
, in the function Test -tmyVart
- Grundy