Skip to content

Instantly share code, notes, and snippets.

@maxkrieger
Created January 1, 2015 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxkrieger/0fc9f66eaa64b3205b70 to your computer and use it in GitHub Desktop.
Save maxkrieger/0fc9f66eaa64b3205b70 to your computer and use it in GitHub Desktop.
// GL HF Translator (or gf hl or hg lf? :D)
function translate(str){
var translation = "";
for(var i=0; i<str.length; i++){
switch(str.charAt(i)){
case "g":
translation += "good ";
break;
case "l":
translation += "luck ";
break;
case "h":
translation += "have ";
break;
case "f":
translation += "fun ";
break;
}
}
return translation;
}
alert(translate(prompt("gl?")));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment