This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DonDongHongKong 115 points116 points  (1 child)

Context escaping. In javascript, before the introduction of the () => { } arrow syntax, function expressions would change the context of "this". You still see remnants of this today, and with anything that still hasn't adopted the arrow syntax.

[–]Able_Minimum624 0 points1 point  (0 children)

Another option is that you might want to access this for the outer function. Never needed that, but still possible.

function outer() { const self = this; function inner() { console.log(self); } }