MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/btxz72/what_are_some_javascript_things_beginners_dont/ep66ln3/?context=3
r/javascript • u/[deleted] • May 28 '19
383 comments sorted by
View all comments
Show parent comments
7
I would guess 2 for the inner log, and 1 for the outer log. Am I mistaken?
5 u/[deleted] May 28 '19 [removed] — view removed comment -1 u/[deleted] May 28 '19 No doubt about it, JS isn’t easy, however, the above list is still accurate and the nuance of the question has to do with IIFE’s, not a different type of ‘this’ binding. 4 u/senocular May 28 '19 Its not IIFE specific. Same applies to a named function declaration called normally.this.a = 1; function foo () { this.a = 2; console.log(this.a); } foo(); console.log(this.a);
5
[removed] — view removed comment
-1 u/[deleted] May 28 '19 No doubt about it, JS isn’t easy, however, the above list is still accurate and the nuance of the question has to do with IIFE’s, not a different type of ‘this’ binding. 4 u/senocular May 28 '19 Its not IIFE specific. Same applies to a named function declaration called normally.this.a = 1; function foo () { this.a = 2; console.log(this.a); } foo(); console.log(this.a);
-1
No doubt about it, JS isn’t easy, however, the above list is still accurate and the nuance of the question has to do with IIFE’s, not a different type of ‘this’ binding.
4 u/senocular May 28 '19 Its not IIFE specific. Same applies to a named function declaration called normally.this.a = 1; function foo () { this.a = 2; console.log(this.a); } foo(); console.log(this.a);
4
Its not IIFE specific. Same applies to a named function declaration called normally.
this.a = 1; function foo () { this.a = 2; console.log(this.a); } foo(); console.log(this.a);
7
u/[deleted] May 28 '19
I would guess 2 for the inner log, and 1 for the outer log. Am I mistaken?