functionbuildCoveTicketMaker( transport ) { returnfunction ( name ) { alert("Here is your transportation ticket via the " + transport + ".\n" + "Welcome to the Cold Closures Cove, " + name + "!"); } } ```
```js var getSubmarineTicket = buildCoveTicketMaker("Submarine"); var getBattleshipTicket = buildCoveTicketMaker("Battleship"); var getGiantSeagullTicket = buildCoveTicketMaker("Giant Seagull");
![Screen Shot 2014-07-29 at 13.19.36.png](http://user-image.logdown.io/user/6619/blog/6590/post/211815/AprhkyhjSF6LexQr6iGl_Screen%20Shot%202014-07-29%20at%2013.19.36.png)
```js function warningMaker( obstacle ){ var count = 0; var zones = []; return function ( number, location ) { count++; var isThere = false; for (var ii = 0;ii<zones.length;ii++){ if(zones[ii][0]==location){ zones[ii][1]=zones[ii][1]+number; isThere = true; break; }} if (!isThere){ zones.push([location,number]); } var list = ""; for(var i = 0; i<zones.length; i++){ list = list + "\n" + zones[i][0] + " (" +zones[i][1]+")"; }
alert("Beware! There have been " + obstacle + " sightings in the Cove today!\n" + number + " " + obstacle + "(s) spotted at the " + location + "!\n" + "This is Alert #" + count + " today for " + obstacle + " danger.\n" + "Current danger zones are: " + list ); }; }