|
|
|
|
|
by glmdev
1504 days ago
|
|
One particularly annoying case comes up when using IIFEs: let c = a + b
(() => { ... })()
This is evaluated as: let c = a + (b(() => {...}))()
which usually results in "TypeError: b is not a function." Obviously this can be solved with a semicolon after the "let c..." line, but another common approach is to just prefix all IIFEs with semicolons, since empty statements are no-ops in JS: let c = a + b
;(() => {...})()
I personally prefer to forego semi-colons, but I have a hard time getting worked up over it either way. |
|