Created
January 21, 2017 11:31
-
-
Save sinewalker/6548b46ff3f69bdceee442dbf0102e2f to your computer and use it in GitHub Desktop.
insult generator (Javascript toy problem)
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
| /* insult generator */ | |
| var BodyParts = ["face", "nose", "hair"]; | |
| var Adjectives = ["smelly","boring","stupid","elderberry"]; | |
| var Words = ["fly", "marmot", "stick", "monkey", "rat", "smeg"]; | |
| var pickRandom = function(pickings) { | |
| return pickings[Math.floor(Math.random() * pickings.length)]; | |
| }; | |
| var body_part = pickRandom(BodyParts); | |
| var adjective = pickRandom(Adjectives); | |
| var rWord = pickRandom(Words); | |
| var randomInsult = "Your " + body_part + " is like a " | |
| + adjective + " " + rWord + "!!!"; | |
| randomInsult; | |
| /* | |
| Exception: SyntaxError: missing ; before statement | |
| @Scratchpad/1:18 | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment