How to assign new function within a function?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • howa

    How to assign new function within a function?

    The topic is not very good, so please see the example below...


    function bar(fn) {

    fn.hi = function() {
    alert('hi');
    }
    };

    bar(

    function() {
    this.hi();
    }

    );

    What I want is I want the have an alert popup in the above code, is it
    possible?


    Thanks.
  • Stevo

    #2
    Re: How to assign new function within a function?

    howa wrote:
    The topic is not very good, so please see the example below...
    ...snip..
    What I want is I want the have an alert popup in the above code, is it
    possible?
    Don't know about anyone else but I'm certainly confused.

    Comment

    Working...