Blog.

Inline Anonymous Funcion Pattern

Code in this post can be obsolete, however, principles and theory may still apply.
var msg = "From inline function";
var result = (function(m) {
    alert(m);
    return "Result of inline function";
}(msg));
alert(result);
saki
Follow me:
Latest posts by saki (see all)

5 Responses

  1. At first glance, the only advantage I see here is you can easily create a private function without polluting the global namespace. The main disadvantage is you can’t re-use the function.

  2. Hi,

    In your examples you have the line:

    link rel=”shortcut icon” ref=”./img/extjs.ico”

    Where i can find this file extjs.ico ?
    Please, can you send to me ?

    Beast regard´s,
    Jose Sousa

  3. Hi,

    In your examples you have the line:

    Where i can find this file extjs.ico ?
    Please, can you send to me ?

    Beast regard´s,
    Jose Sousa

  4. Sometimes you need to calculate result, e.g. while configuring a component, one of the options has to be “calculated”.

    Performance is not a point here.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your username and password to log into your account. Don't have an account? Sign up.

Want to collaborate on an upcoming project?