Created
August 2, 2014 04:08
-
-
Save macikokoro/5cb92790f20b21e02632 to your computer and use it in GitHub Desktop.
Example of calling a function expression with console.log.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adventureSelector ( userChoice ) { | |
if (userChoice == 1) { | |
return function () { | |
alert("You've selected the Vines of Doom!\n" + | |
"Hope you have a swingin' time."); | |
}; | |
} else if (userChoice == 2) { | |
return function () { | |
alert("Looks like you want the Lake of Despair!\n" + | |
"Watch out for crocs. And I ain't talkin' about shoes."); | |
}; | |
} else if (userChoice == 3) { | |
return function () { | |
alert("The Caves of Catastrophe, really?\n" + | |
"Alright, well....nice knowing you."); | |
}; | |
} | |
} | |
console.log(adventureSelector(3)()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment