A LIST Apart: For People Who Make Websites

No. 262

Discuss: Getting Out of Binding Situations in JavaScript

Pages

« First  <  4 5 6

51 Re: function = object

Hey Varun,

Well, doh!

Look at your code:

doe.fx('Mark')

This code explicitly calls method fx on object doe. This is explicit binding, as described at the beginning of the article. As the fx method 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

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

Pages

« First  <  4 5 6

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.

Remember me

Forgot your password?

Subscribe to this article's comments: RSS (what’s this?)