Last active
November 10, 2015 13:41
-
-
Save arnemart/c261312f36f756b25619 to your computer and use it in GitHub Desktop.
GOOOOOOOOAL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function oo(n) { | |
return Object.defineProperties({}, { | |
al: { get: () => 'go' + [...Array(n + 1)].join('o') + 'al' }, | |
o: { get: () => oo(n + 1) } | |
}); | |
} | |
var go = oo(0); | |
console.log(go.al); //=> goal | |
console.log(go.o.o.o.o.o.o.o.al); //=> gooooooooal | |
function g() { | |
function al(n) { | |
var r = () => al(n + 1); | |
r.al = 'go' + [...Array(n + 1)].join('o') + 'al'; | |
return r; | |
} | |
return al(0); | |
} | |
console.log(g().al); //=> goal | |
console.log(g()()()()().al); //=> goooooal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment