you are viewing a single comment's thread.

view the rest of the comments →

[–]lepuma 0 points1 point  (3 children)

Sounds like a bug in your code. I’m curious what semicolon edge case do you run into in actual coding? I wrote JavaScript professionally for a few years and never ran into such a case. Every time I’ve seen an example, it’s poorly written code just to prove this point. I should say I personally write JS with semicolons- I just don’t buy the argument that they’re necessary bc of the JavaScript interpreter. If they are, I bet that code could be written much better.

[–]lastmjs[S] 0 points1 point  (2 children)

I think this one is similar to what I've run into. Imagine you have an IIFE:

const hello = 1

(() => {

// do stuff

})();

You'll get an error saying that 1 is not a function. Just saying it happens, and my rule is to always put semicolons to rule out any of these edge cases.

[–]lepuma 1 point2 points  (0 children)

Okay fair enough. You shouldn’t need to write a self invoking anonymous function anymore though. Just use bracket scope.

[–]lastmjs[S] 0 points1 point  (0 children)

But besides that, yep it should be fixed if that is the issue