Skip to content

Instantly share code, notes, and snippets.

@micheledisalvatore
Created March 18, 2021 23:18
Show Gist options
  • Save micheledisalvatore/c8cba89932bad9aef95ae601e7b893f2 to your computer and use it in GitHub Desktop.
Save micheledisalvatore/c8cba89932bad9aef95ae601e7b893f2 to your computer and use it in GitHub Desktop.
js fooool
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