Skip to content

Instantly share code, notes, and snippets.

@stujo
Created May 21, 2014 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stujo/c3c4f31ca7571c39591b to your computer and use it in GitHub Desktop.
Save stujo/c3c4f31ca7571c39591b to your computer and use it in GitHub Desktop.
expose_via_closure.js
var exposed = function (){
function my_secret()
{
return 'I like unicorns'
}
this.tell_secret = function()
{
return 'Hello! Shhh, but ' + my_secret() + "!";
}
};
try {
console.log(exposed.my_secret());
}
catch(err) {
console.log('Error calling my_secret [' + err + ']');
}
console.log(exposed.tell_secret());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment