logoalt Hacker News

tinyhitmanlast Tuesday at 11:13 PM1 replyview on HN

Could be to allow use of local variables that do not leak into the scope this code is executed in. That's what I use this pattern for.


Replies

crdrostlast Tuesday at 11:56 PM

pro tip: no longer necessary

    { let count = 50; const interval = setInterval(() => { addSnakeNode(); if (--count <= 0) clearInterval(interval); }, 100) }