JavaScript anonymous functions, weird or callbacks to the future?

Translate This Page

JavaScript anonymous functions, weird or callbacks to the future?

  • Comments 4

This whole javascript anonymous function is just odd isn't it?  Like that beautiful women who goes out with that guy who is uglier then even me.  But maybe not that strange.  Where did it come from.

Well as usual I checked with the Ecmascript standard 262 and searched for anonymous functions, nothing came up.  Does this mean that it shouldn't be used?  No.

Then I begin to think about anonymous functions in C# and what they do.  Here is what one of the things that they can do: Call another function and then continue processing till that function completes it's operation and passes pack information.

But now, the problem becomes this: How does the system know that the function is done, or what it promises to return.

More later on that.


Leave a Comment
  • Please add 5 and 6 and type the answer here:
  • Post
  • Regarding callbacks, the only thing that I hope for is that javascript supports chained event handlers like it used to be in C#. When coding for webpages, lots of time I found that the newly registered event handler just overwritten the old one, so the page starts behave funny.

    Sometime I can go the jQuery way to create custom container object to hold the events, by that's just inconvenient.

  • Cheong00,

    Again, good feedback.  Fodder for a future blog.  JavaScript anonymous functions wrt to chain events.  Good.

    For readers who might not know this, Cheong is an MSP, which means that he is one of the respected Microsoft experts.  And I wish he would share his web site or blog with us. :)


  • Oh, I don't have blogs or personal website.

    I have had one during my school days, but I'm too lazy to bother update it often. :P

    In these days I just wonder around the BBSs, forums and others' blogs to discover topics that catch my interest.

  • cheong00,

    You are always welcomed to make comments on my blog.  I really appreciate it.


Page 1 of 1 (4 items)
Generic Content

Legal Note:

  1. The author, Sam Stokes, is an employee of Microsoft
  2. There is no guarantee that anything I write is correct, I do try to make sure that what I write is correct.
  3. Use anything written in this blog at your own risk
  4. Test what I write about before using the information
  • Sometimes posts will disappear because I realized that they really don't fit with the total chaos of what I write about
  • Links are tested and available on date of publication, what others do with their links are out of my control


  • Whatever I write on this blog is unedited by management or anyone, which should be obvious from the randomness of the blog.  I simply write about things I like.
  • Microsoft does not restrict me in anyway, so I generallyblather about whatever I want to.
  • For personal reasons I will not write about:
    • Company confidential stuff, mainly because Microsoft is more transparent than any company I have ever worked for.
    • Other people unless they give me permission to write about them