Skip to content

Instantly share code, notes, and snippets.

@jmateus
Created July 29, 2014 16:15
Show Gist options
  • Save jmateus/b48b8cefa06b386c9165 to your computer and use it in GitHub Desktop.
Save jmateus/b48b8cefa06b386c9165 to your computer and use it in GitHub Desktop.
g()('al')
// Yet another g()('al') solution
// https://github.com/eatnumber1/goal
var g = function (str, calls) {
calls = calls || 0;
if (str) {
return 'g' + Array(calls + 1).join('o') + str;
}
return function (str) {
return g(str, calls + 1);
};
}
console.log(g('al'));
console.log(g()('al'));
console.log(g()()()('al'));
console.log(g()()()()()()()()()()()('al'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment