Skip to content

Instantly share code, notes, and snippets.

@rishabg
Last active January 20, 2017 15:14
Show Gist options
  • Save rishabg/4beba06d3c8d4b7a3183108e4b7ae383 to your computer and use it in GitHub Desktop.
Save rishabg/4beba06d3c8d4b7a3183108e4b7ae383 to your computer and use it in GitHub Desktop.
//Ask if the candidate has front-end experience
//Let's say you have a "class" Vehicle
function Vehicle(...){
...
}
Vehicle.prototype.honk = function(){
console.log("honk");
}
Vehicle.prototype.brake = function(){
console.log("squeal");
}
Vehicle.prototype.revv = function(){
console.log("...");
}
//Let's say you have some code like the following available
var loud = { //or assume that this is loaded via require
honk: function() {
console.log(“LOUD HONK”);
},
brake: function() {
console.log("SCREEEECH!");
},
revv: function() {
console.log("VROOOM");
}
}
/*
Assume the following “inheritance"
Car < Vehicle
Truck < Vehicle
Bike < Vehicle
Instances of Cars and Trucks are "loud"
Instances of Bikes are not
Can you set up the Car, Truck and Bike classes?
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment