Last active
August 21, 2016 09:15
-
-
Save mcmar/cf1e725ad223600db2379d22997d67ec to your computer and use it in GitHub Desktop.
Scary People
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 scaryPeople(n) { | |
| if (!n) { | |
| return "Normal people scare me"; | |
| } | |
| const quote = n%2 ? '"' : "'"; | |
| return "Normal people wearing "+quote+scaryPeople(n-1)+quote+" t-shirts scare me"; | |
| } |
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 scaryPeople(n, str='Normal people scare me') { | |
| if (!n) { | |
| return str; | |
| } | |
| const quote = n%2 ? '"' : "'"; | |
| return scaryPeople(n-1, "Normal people wearing "+quote+str+quote+" t-shirts scare me"); | |
| } |
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 scaryPeople(n, front='', back='') { | |
| if (!n) { | |
| return front+"Normal people scare me"+back; | |
| } | |
| const quote = n%2 ? '"' : "'"; | |
| return scaryPeople(n-1, "Normal people wearing "+quote, quote+" t-shirts scare me"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment