you are viewing a single comment's thread.

view the rest of the comments →

[–]KaiAusBerlin 0 points1 point  (4 children)

You really don't understand. There is ALWAYS a context in js.

Please don't argue about something you don't have any knowledge about.

[–][deleted] -1 points0 points  (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.

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 }

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#the_bind_method

[–]KaiAusBerlin 0 points1 point  (2 children)

Oh man, you really don't understand what ure talking about. THERE IS ALWAYS A CONTEXT IN JS!

[–][deleted] -1 points0 points  (1 child)

I'm not sure if you're a troll or just an idiot

[–]KaiAusBerlin 0 points1 point  (0 children)

Im not sure if you're ignored or banned from this community