javascript - Another variable trying to get outside of a function -
I have some functions inside the functions and I'm having trouble retrieving a variable. It will be easy to show in the code which I want to log in to the three functions in the tectreet function, but is not sure how to do this.
test (); Function test () {var abc; Function one () {abc = 1; two(); } Var three; Function Two () {console.log (ABC); Three = 2; Smile; } One(); } Function testit () {console.log (three); two(); }
You will do the following to test the object:
< Previous> function testing () {this.abc = 0; This.three = 0; this one(); } Test.prototype.one = function () {this.abc = 1; This.two (); } Test.prototype.two = function () {console.log (this.abc); this. Thirty = 2; } Test.prototype.testit = function () {console.log (this.three); This.two (); }
and run it like this:
testObj = new test (); TestObj.testit ();
Hope it helps.
EDIT: BTW: If you call the function 'two' back to do 'testit' work then you have an infinite loop.
Comments
Post a Comment