0

Reading through You Don't Know Javascript : this & Object Prototypes, there is quite a lot of mention this binding. Correct me if I get this wrong, this will bind according to where the function was called aka the call-site.

What exactly is this binding to when a function is called? And what does binding mean in this context? I probably missed something along the line while reading however just want to be sure what binding means in this context.

Thank you

wallwalker
  • 365
  • 1
  • 9
  • 18
  • 2
    Welcome to StackOverflow! It looks like your question has probably been asked - it's a pretty classic JS question. You might want to look at [How does the “this” keyword work?](https://stackoverflow.com/questions/3127429/how-does-the-this-keyword-work) – Richard JP Le Guen Oct 26 '17 at 00:53
  • In the context of JavaScript, a **binding** is simply an entry in an environment (scope). It's an umbrella term for variable, parameter, etc. The text could probably have said "`this` *variable*" instead, but `this` isn't like other variables, so that wouldn't be a correct use of the term. The phrase "`this` binding" is also used in the language specification: https://ecma-international.org/ecma-262/8.0/#sec-resolvethisbinding – Felix Kling Oct 26 '17 at 01:00

0 Answers0