Skip to content

Instantly share code, notes, and snippets.

@yaroslavya
Last active December 12, 2015 05:08
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 yaroslavya/4719375 to your computer and use it in GitHub Desktop.
Save yaroslavya/4719375 to your computer and use it in GitHub Desktop.
Answer to https://gist.github.com/rmurphey/576723 for say('Hello')('world!'); question, but in a very custom way.
function say(a){
var inner = function(b){
return say(a+b);
};
inner.toString = function(){
return a;
};
return inner;
}
console.log(say('h'));/will log h
console.log(say('hello')('world');//will log helloworld
console.log(say('h')('e')('l')('l')('o')(' ')('w')('o')('r')('l')('d')('!'));//you know what it will do ;-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment