Skip to content

Instantly share code, notes, and snippets.

@RyanCCollins
Created September 26, 2016 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanCCollins/7059de34c403fc00f3cfe59824df9bc8 to your computer and use it in GitHub Desktop.
Save RyanCCollins/7059de34c403fc00f3cfe59824df9bc8 to your computer and use it in GitHub Desktop.
This binding, how JavaScript does it.
  1. Was the object called with the new keyword, if so use the newly created object.
  2. Was the object called with Call or Apply? If so, use that object.
  3. Was the object called by a containing / owning object? If so, use it.
  4. Default to the global.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment