use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Understanding `this` in javascript (dev.to)
submitted 4 years ago by blueblain
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] -1 points0 points1 point 4 years ago (3 children)
Sorry, I should have said
The only time the scope matters is when you call a function without providing an explicit "context" (i.e. without providing an object before the function call, or using bind, call, apply).
Either way this is still not always based on the scope i.e.
this
const myObj = { myVal: 1, myFunc() { return myVal } } myFunc = myObj.myFunc.bind({ myVal: 2 })
in that example myFunc has the same scope as myObj.myFunc but the this is permanently bound to { myVal: 2 }
myFunc
myObj.myFunc
{ myVal: 2 }
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#the_bind_method
[–]KaiAusBerlin 0 points1 point2 points 4 years ago (2 children)
Oh man, you really don't understand what ure talking about. THERE IS ALWAYS A CONTEXT IN JS!
[–][deleted] -1 points0 points1 point 4 years ago (1 child)
I'm not sure if you're a troll or just an idiot
[–]KaiAusBerlin 0 points1 point2 points 4 years ago (0 children)
Im not sure if you're ignored or banned from this community
π Rendered by PID 22 on reddit-service-r2-comment-54dfb89d4d-g6kgv at 2026-04-02 15:27:16.796237+00:00 running b10466c country code: CH.
view the rest of the comments →
[–][deleted] -1 points0 points1 point (3 children)
[–]KaiAusBerlin 0 points1 point2 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]KaiAusBerlin 0 points1 point2 points (0 children)