Created
February 22, 2014 04:17
-
-
Save dugdaniels/9148672 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function named(){ | |
(function(){ | |
this.foo = function() { | |
alert('bar'); | |
} | |
})(); | |
} | |
named.foo(); |
iamdustan
commented
Feb 22, 2014
// calling `named()` with this will return an object which has the `foo` function as a member
function named(){
this.foo = function() {
alert('bar');
}
return this;
}
named().foo()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment