Skip to content

Instantly share code, notes, and snippets.

@vstarck
Created August 31, 2011 14:38
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 vstarck/1183697 to your computer and use it in GitHub Desktop.
Save vstarck/1183697 to your computer and use it in GitHub Desktop.
function f() {
var cache = [].join.call(arguments, '');
return !cache ? '' : function sub() {
cache += [].join.call(arguments, '');
return !arguments.length ? cache : sub;
}
};
f('This ')('i')('s a sentence')() + f('123')() == 'This is a sentence123'; // true
f('foo', 'bar')(' baz')(); // "foobar baz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment