Created
March 23, 2016 14:58
-
-
Save mindplace/5e3466098c0ce47e1a36 to your computer and use it in GitHub Desktop.
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 inconsistentAdder(numOne, numTwo) { | |
| console.log("Let's play a game! Me, the program, will flip a coin."); | |
| console.log("If it's heads, I'll add up your numbers,"); | |
| console.log("and if it's tails, I'll throw them back in your face."); | |
| console.log("Flipping a coin..."); | |
| var add = function add(numOne, numTwo) { return numOne + numTwo}; | |
| var coin = ["heads", "tails"][Math.floor(Math.random())]; | |
| if (coin === "heads") { | |
| console.log("\nHeads. Fine, here's your sum...") | |
| console.log(add(numOne, numTwo)) | |
| } | |
| else { | |
| console.log("\nTails! Take your stupid numbers back!") | |
| console.log([numOne, numTwo]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment