Created
February 13, 2010 00:08
-
-
Save geoffb/303132 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
var myObject = function (someParam) { | |
var privateMember = "foobar"; | |
return { | |
publicMethod: function () { | |
return "Hi! " + someParam + " " + privateMember; | |
} | |
}; | |
}; | |
var foo = new myObject("This is a test!"); | |
console.log(foo.publicMethod()); // "Hi! This is a test! foobar" | |
console.log(foo.privateMember); // undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment