Skip to content

Instantly share code, notes, and snippets.

@bellbind
Created July 28, 2014 07:45
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 bellbind/bc1e2438ba572449af6a to your computer and use it in GitHub Desktop.
Save bellbind/bc1e2438ba572449af6a to your computer and use it in GitHub Desktop.
[ES5][nodejs] g()()()()('al') -> "gooooal"
// [ES5][nodejs] g()()()()('al') -> "gooooal"
// see: https://github.com/eatnumber1/goal
var g = function g(al) {
"use strict";
var go = this ? this : "g";
return al ? go + al: g.bind(go + "o");
};
console.log(g('al')); // => "gal"
console.log(g()('al')); // => "goal"
console.log(g()()('al')); // => "gooal"
console.log(g()()()()('al')); // => "gooooal"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment