3 ms·
In this case, yes. Its scope should be the lowest necessary scope. Does JS provide static variables in functions? If not, then that forces you to lift it to som
by Jtsummers 2y ago
In this case, yes. Its scope should be the lowest necessary scope. Does JS provide static variables in functions? If not, then that forces you to lift it to some other scope like file or module scope or the surrounding function or class if that's viable.
- porridgeraisin 2y ago> Does JS provide static variables const f = (() => { let cnt = 0; return () => console.log("cnt", cnt); })(); :-)