Skip to content

Instantly share code, notes, and snippets.

@em
Created May 4, 2011 22:01
Show Gist options
  • Save em/956125 to your computer and use it in GitHub Desktop.
Save em/956125 to your computer and use it in GitHub Desktop.
function Car() {
this.beep = function() {
alert('beep');
};
}
function Factory() {
this.createCar = function(properties) {
Car.apply(properties);
return properties;
};
}
var factory = new Factory();
var car = factory.createCar({
color: "red"
});
alert(car.color);
car.beep();​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment