Itinerary/Ports
Itinerary/Ports
Now we can actually start incorporating our objects. We're going to create a new Itinerary with some Port objects inside of our HTML, and we'll use our Controller to render all of an itinerary's ports to the screen.

## Challenge
Instantiate an Itinerary with some Ports inside of index.html and loop over the itinerary's ports, rendering an element to the DOM for each one.
To complete this challenge, you will need to:
- Include in your
itinerary.jsandport.jsfiles intoindex.htmlusingscripttags. - In the inline
scriptblock, create some newPortinstances and add them to a newItineraryinstance. - Create a new
divwith the idportsnested inside theviewportdiv. - In
style.css, add a new selector for#ports. Specify a width of0px, amargin-topof96px, a display offlexand ajustify-contentofspace-around. - Add a new selector for
#ports > .port. Specify a width of64px, a height of32pxand set the background image to theport.pngimage file. - Add a new method to the
Controllerprototype calledrenderPorts. It should have a parameter ofportswhich will receive an array as an argument. - Inside
renderPorts, usedocument.querySelectorto find theportsdiv and assign it to a variable namedportsElement. SetportElement's width to0px. - You should then iterate over the array passed to the
portsparameter usingforEachand for each one should render a newdivto the DOM with the classport - Each new port element should have a data attribute of
portIndexset to the port's index in theportsarray - Add 256px to the
#portsdiv every time a new port element is appended to it - In the inline
scriptblock inindex.html, call thecontroller.renderPortsmethod, passing in yourItineraryinstance'sports.