Please post your answers to a JSBin within a week of receiving this test. Feel free to use whichever compiled-to-JS language you want (Coffeescript, ES6/Babel, vanilla Javascript, etc..), but be prepared to explain what your code compiles down to in plain ol' Javascript if you do.
- Create a Vehicle class with
getName
andsetName
methods which manipulate aname
property on its class instances. - Write a getter/setter for
wheels
andseats
using the get/set keywords if your language of choice supports them (pro-tip: it probably does). - Create Car and Motorcycle classes which extend from Vehicle and set the number of seats/wheels appropriately.
- Instances should be properly inherit from your class, so
myCarInstance instanceof Car
should returntrue
.
- Add a dropdown that lets a user select a vehicle type and an input to name the vehicle.
- Add a
<ul>
on the page to contain a list of vehicles - Add a "create" button that adds an instance of the selected vehicle to the
<ul>
with the entered name. - Inside each list item, print the vehicle's name, and add an "info" button which, when clicked, console.logs the text "I am {{ vehicle name}}, a {{ type of vehicle }} with {{ number of wheels }} wheels, and {{ number of seats }} seats!"
- Do use a UI framework if you want. Be prepared to explain, in broad strokes, what the framework is doing under the hood.
- Limit your use of global variables (you can use a single namespace). However, we won't ding you for variables created by your framework of choice (
$
,angular
, orreact
). - Don't spend more than an hour on this; we value working code, not perfect code.