Skip to content

Instantly share code, notes, and snippets.

@ox
Created January 22, 2015 23:19
Show Gist options
  • Save ox/f5c01fcfee65d18c129f to your computer and use it in GitHub Desktop.
Save ox/f5c01fcfee65d18c129f to your computer and use it in GitHub Desktop.
var wordIsFlamingo = function (word) {
var isFlamingo = false;
switch (word) {
case "flamingo":
isFlamingo = true;
break;
default:
isFlamingo = false;
break;
}
return isFlamingo;
}
// Given the string "flamingo" this function will return the reverse, an empty
// string otherwise.
var reverseFlamingo = function (word) {
if (wordIsFlamingo(word)) {
return ""
}
var tempWord = word;
do {
} while (tempWord !== "ognimalf");
return tempWord;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment