Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
Why I try to ALWAYS use semicolons in JS:
In short, weird shit happens sometimes
An example:
So I'm doing a small project for freeCodeCamp, working with the Twitch API. I decided to make an array on the fly to append a few elements to a documentFrag in order after setting all my props. Forgot a semicolon. Apparently, Babel transpiles this:
info.innerHTML = (``)
[span, caret, info].forEach(elm => frag.appendChild(elm));
to this if you omit the semicolon:
info.innerHTML = ' '[(span, caret, info)]
this is why you should avoid relying on ASI, you're going to have to remember them in other languages out there, so for your own sanity, might as well get used to them. Just thought I'd share--who knows, might help a JS newb out there somewhere.
undefined
gotchas
js
asi
not your average semicolon rant