Skip to content

Instantly share code, notes, and snippets.

@mcmar
Last active August 21, 2016 09:15
Show Gist options
  • Select an option

  • Save mcmar/cf1e725ad223600db2379d22997d67ec to your computer and use it in GitHub Desktop.

Select an option

Save mcmar/cf1e725ad223600db2379d22997d67ec to your computer and use it in GitHub Desktop.
Scary People
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";
}
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");
}
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