Skip to content

Instantly share code, notes, and snippets.

@TSMMark
Created May 4, 2016 15:19
Show Gist options
  • Save TSMMark/0183f70167751af546bc16000f35f66f to your computer and use it in GitHub Desktop.
Save TSMMark/0183f70167751af546bc16000f35f66f to your computer and use it in GitHub Desktop.
Chloe's javascript closure
function SecretHuman (name) {
this.getName = function () {
return name
}
}
var person = new SecretHuman("Chloe")
console.log("My name is " + person.getName()) // => My name is Chloe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment