Returning Functions and Immediate Invocation

// ride and wait time
var parkRides = [["birch bumpers", 40], ["dank bumpers", 36], ["trap bumpers", 41], ["wtf bumpers", 43],];
// fast pass for faster line
var fastPassQueue = ["birch bumpers", "dank bumpers", "trap bumpers", "wtf bumpers"];
// allRides arg - this parameter will be the array of the rides and their wait time
// passrides arg - this will be the array of the nxt available fast pass rides
// pick arg - this will be the actual ride for which our customer would like a ticket!
function buildTicket(allRides, passRides, pick) {
	if(passRides[0] == pick){
		var pass = passRides.shift();
		return function() {alert("Quick! You've got a fast pass to " + pass +"!"); 
	};
	} else {
		for(var i =0; i<allRides.length;i++){
			if(allRides[i][0]==pick){
				return function () {alert("A ticket is print for " + pick +"!\n" + "Your wait time is about " + allRides[i][1] + " minutes.");
				};
			}
		}
	}
}
var wantsRide = "birch bumpers";
// self invoking function when you add () at the end off the function
buildTicket(parkRides, fastPassQueue, wantsRide)();

 

This is hypothetical fast pass system created with functions, arrays, conditional, and for loop statement. All written javascript.