0x4E4F@lemmy.dbzer0.com to Programmer Humor · 3 months agoWirks every timelemmy.dbzer0.comimagemessage-square15fedilinkarrow-up1103arrow-down112
arrow-up191arrow-down1imageWirks every timelemmy.dbzer0.com0x4E4F@lemmy.dbzer0.com to Programmer Humor · 3 months agomessage-square15fedilink
minus-squareEranziel@lemmy.worldlinkfedilinkarrow-up5·3 months agoSemicolons are technically optional in JS, but there are some rare cases where omitting them can result in different behaviour. And this is why you should enforce code style, kids. Preferably with an automated tool.
minus-squareExcigma@lemmy.worldlinkfedilinkarrow-up1·edit-23 months agoI’m on my phone rn so can’t format well, but one such example is: const thing = require(“module”) (async () => { something })() without a ; at the end of the first line, JavaScript will try to do require(“module”)() instead
Semicolons are technically optional in JS, but there are some rare cases where omitting them can result in different behaviour.
And this is why you should enforce code style, kids. Preferably with an automated tool.
I’m on my phone rn so can’t format well, but one such example is:
const thing = require(“module”)
(async () => { something })()
without a ; at the end of the first line, JavaScript will try to do require(“module”)() instead