Sailing
Sailing
We have a ship and some ports - lets sail away!!!

Challenge
Create a new "Set Sail" button which, when clicked, will move the ship gradually over to the next port.
To complete this challenge, you will need to:
- Add a button to
index.htmlwith an id of#sailbutton. - Style and position the button using CSS.
- Modify the
Controllerconstructor so it takes a parameter ofship. Setthis.shiptoshipand modify any other references toshipinControllerto come fromthis.ship, not method parameters. - Modify your constructor call in
index.htmlso it also takes a ship. - Add a
clickevent listener to the button inside theControllerconstructor and set the callback function to an arrow function that callsthis.setSail. - Add a
setSailmethod to theController.prototype. - Use the index of the next port in the ship's itinerary to find the corresponding DOM element
- Set the ship's left position to the next port's
offsetLeft- do so gradually usingsetInterval, adding 1px every n (you choose) milliseconds, so the boat moves along gradually. Be sure to useclearIntervalwhen the ship reaches the port, and be sure to callship.dockso our instance ofShipis updated. - Alert the user that they're at the end of their cruise if they attempt to go further than the itinerary.