Skip to content

Instantly share code, notes, and snippets.

@kennethkoontz
Created February 11, 2014 19:01
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 kennethkoontz/8941657 to your computer and use it in GitHub Desktop.
Save kennethkoontz/8941657 to your computer and use it in GitHub Desktop.
function Car() {
this.speed = 0
}
Car.prototype.accelerate = function(by) {
var self = this;
function throttler() {
if (by > 20) {
self.speed += 20;
} else {
self.speed += by;
}
}
throttler();
}
accord = new Car()
accord.accelerate(40);
console.log(accord.speed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment