Created
May 21, 2014 16:23
-
-
Save stujo/c3c4f31ca7571c39591b to your computer and use it in GitHub Desktop.
expose_via_closure.js
This file contains 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 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