Skip to content

Instantly share code, notes, and snippets.

@JasonDeving
Created March 20, 2016 02:52
Show Gist options
  • Save JasonDeving/bf8bfb60e31b9561c829 to your computer and use it in GitHub Desktop.
Save JasonDeving/bf8bfb60e31b9561c829 to your computer and use it in GitHub Desktop.
Toaster
var Toaster = function(){
//some private methods and properties
var maxTemp = 500,
temp: 0;
return {
//some public methods and properties, etc
setTemp: function(newTemp) {
if (newTemp > maxTemp) {
console.log("That temp is too high!");
} else {
temp = newTemp;
}
}
};
};
var myToaster = Toaster();
myToaster.setTemp(300);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment