Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function Car() {
this.wheels = arguments[0];
this.type = arguments[1];
}
function SportsCar() {
this.speed = arguments[0];
}
SportsCar.prototype = new Car();
SportsCar.prototype.constructor = SportsCar;
var ferrari = new SportsCar('300km/h');
var fuscaoPreto = new Car(4, 'motor');
console.log(ferrari);
console.log(fuscaoPreto);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment