Discuss: Getting Out of Binding Situations in JavaScript
by Christophe Porteneuve
- Editorial Comments
52 Re: Great Article!
Richard: why, thank you. ‘most welcome, such “a-ha!” moments are the specific goal of writing such a piece :-)
posted at 10:47 am on August 21, 2008 by Christophe Porteneuve
53 OMG - I'm sorry. I meant to comment on another art
I apologize for insulting your post. I don’t know how I got on these comments.
posted at 08:52 pm on September 27, 2008 by Mike Mike
54 thank you
thanks for this article…I’ve readed many articles about this (even book’s capitules) and never it had been clear to me…your articles was better than all that books…
now I’ve a question..why js do it in this way?…I think many times than seemed be a complications in a language in a future this became in advantages…like closures or metaprogramming in ruby…but this binding look very weird to me…this has any advantage?…..
thank you again and good luck
posted at 01:47 am on April 25, 2011 by coco
Discussion Closed
New comments are not being accepted, but you are welcome to explore what people said before we closed the door.
Got something to say?
Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.
Create a new account or sign in below if you’d like to leave a comment.
Subscribe to this article's comments: RSS (what’s this?)




51 Re: function = object
Hey Varun,
Well, doh!
Look at your code:
doe.fx('Mark')This code explicitly calls method
fxon objectdoe. This is explicit binding, as described at the beginning of the article. As thefxmethod was not pre-bound, it uses the explicit binding you give it.As I said, methods are not intrinsically attached to a given object. They use whatever binding is applicable when they’re run.
‘hope this makes it clearer for you.
posted at 10:46 am on August 21, 2008 by Christophe Porteneuve