Created
March 18, 2021 23:18
-
-
Save micheledisalvatore/c8cba89932bad9aef95ae601e7b893f2 to your computer and use it in GitHub Desktop.
js fooool
This file contains 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
let invocationsCounter = 0 | |
function f(s) { | |
const stringsOfO = 'o'.repeat(invocationsCounter) | |
if (s) { | |
return `f${stringsOfO}${s}` | |
} | |
invocationsCounter++ | |
return (() => f)() | |
} | |
console.assert(f()()()()('l') === 'fooool') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment