Last active
January 20, 2017 15:14
-
-
Save rishabg/4beba06d3c8d4b7a3183108e4b7ae383 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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