Search Results

Search found 1 results on 1 pages for 'elduderino'.

Page 1/1 | 1 

  • binding an object to the global scope

    - by elduderino
    I have the following code: var myVar = (function (window) { myobj = {}; myobj.boo = function() { alert('hi'); }; window.myVar = myobj; })(window); myVar.boo(); Why don't I get back the alert when I call myVar.boo() ? I've created an anonymous self-executing function and fed in the window object. Inside that I have another object with a method assigned to it. I then assign the global myVar variable to this obj. This should provide an alias to the my myobj object. However when I call the function I get an Cannot call method 'boo' of undefined error

    Read the article

1