Skip to content

Instantly share code, notes, and snippets.

@exts
Created March 9, 2017 12:21
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 exts/d8674120a8d7c2fc56513bb9160cd2ee to your computer and use it in GitHub Desktop.
Save exts/d8674120a8d7c2fc56513bb9160cd2ee to your computer and use it in GitHub Desktop.
function say(a) {
cleanUp = function(str) {
return str.replace(/[^a-zA-Z0-9]+/, "");
}
addDashes = function(str) {
return cleanUp(str).split("").join("-");
}
return function(b) {
return addDashes(a) + " " + addDashes(b);
}
}
console.log( say("Domino's")("Pizza") === "D-o-m-i-n-o-s P-i-z-z-a" );
console.log( say("Front")("End!") === "F-r-o-n-t E-n-d" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment