javascript - extend scope of inner var into another function -
I'm sure you've gone a long way, but I can not understand a thread witch really fit My needs
How do I get the external to work in the outside? Please note, I know that this It is possible that it should be made universal to exclude X but what I want to achieve is to get this work out of the scope inside Did you try: Functions only share scope with the declared variable in their parent scope. Edit Completion I do not have anything to add to that you make your work with the returning values: function externally () {/ * some * / var internal = function () {back true}; Inner (); }; External () function external (two) () (if (internal == true) / * do something; outerTwo ();
var x; function external () {/ * some * / var internal = function () {x = 5 Console.log (x + "works in internal (");}; inner (); console.log (Ex + "works in the external");}; outerOne (); function outerTwo () {console.log (ex + "works in the outer");}; outerTwo (); < / Code>
function external () {/ * some * / var internal = function () {var x = 5 works in console.log (x + "internal") is"); Return x; }; Var x1 = inner (); Console.log (x1 + "Works in External");); Return x1; }; Var x2 = External (); Function outerTwo () {console.log (x2 + "works in external (two)"); }; OuterTwo ();
Comments
Post a Comment