// 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.
Monitored by Tinder The inner workings of the Tinder algorithm remain shrouded in secrecy, known…
Use fav19073 30% OFF Shop Now I recently had a fantastic buying experience on Temu,…
Unlocking Affordable Streaming: How Gamsgo.com is Revolutionizing Netflix Subscriptions Sign Up Save1 coupon code for…
Planting your own vegetables and fruit is a great way to save money and eat…
While AI has the potential to automate many tasks, there are still some jobs that…