The code above doesn't work because ASI insert semicolons in an unexpected place
More like someone didn’t read on how ASI works and has wrong expectations.
There are two ways of learning, each with its own benefits. One is to read carefully and note the common pitfalls to not step into these. Another is to skim through, get the intuition and address pitfalls later. What we see here is just that “address later” part. Which is not an issue on itself, cause that’s the way you chose to learn.
Since ASI is a part of the language everyone has to learn it, because now if you put a semicolon like this:
return
{
…
};
It still doesn’t do what an unaware person would expect.Reply In many environments, "For that reason, I decided to use semicolons" will cause all of your code to be automatically rejected, because https://standardjs.com/rules.html "No semicolons" is enforced at the SCM layer.
Replysite design / logo © 2022 Box Piper