Re:JavaScript quiz that may confuse you
by glmdev on Wednesday May 04, 2022 @09:28AM
(#31260072)
One particularly annoying case comes up when using IIFEs:
This is evaluated as:
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:
I personally prefer to forego semi-colons, but I have a hard time getting worked up over it either way.
[ Parent
| on HN ]
There are no comments on this comment yet.