Hi,
This is a fun question ^^ Actually, since it's a how-to kind of question, the best place to ask it is on StackOverflow, under the scala.js tag. [1] Would you mind to repost it there, and then I'll copy-paste my answer below.
Scala.js does not have an equivalent to the `arguments.callee` of JavaScript. More generally, it does not have an equivalent to `arguments`. So a lambda cannot read a reference to itself, unless it is given to it via its captured environment. This can be achieved by storing the lambda in a `val` in the `once` method. Ideally, one would like to write this: