Hide full rooms - bonk.io

Hides rooms that are full in bonk.io.

< Σχολιασμός για τον κώδικα Hide full rooms - bonk.io

Ερώτηση/σχόλιο

§
Δημοσιεύτηκε: 22/11/2022

I haven't tried the script (I wouldn't want to hide full rooms), but the fact that you didn't waste time adding semicolons to the JavaScript is amazing; more people need to follow

§
Δημοσιεύτηκε: 22/11/2022

I haven't tried the script (I wouldn't want to hide full rooms), but the fact that you didn't waste time adding semicolons to the JavaScript is amazing; more people need to follow

Using semicolons is recommended by most of the javascript community. Javascript automatically inserts semicolons where it sees fit, but there exist edge cases that will break this expected behaviour. For example if you start a line with parentheses (e.g: executing a function inside a closure, or using a Number function on a raw number), javascript might interpret this as you passing parameters to some invocation on the line above.

So while 99% of the time it's just personal preference, that 1% of the time will actually produce unexpected results.

§
Δημοσιεύτηκε: 23/11/2022
Επεξεργάστηκε: 23/11/2022

So while 99% of the time it's just personal preference, that 1% of the time will actually produce unexpected results.

If you're able to stay aware of the edge cases ("^(", "^\["), what's wrong with explicitly stating semicolons there and using none by default? (Especially if the code is short enough that it's easy to test and doesn't require multiple maintainers, like here)

§
Δημοσιεύτηκε: 26/11/2022

If you're able to stay aware of the edge cases ("^(", "^\["), what's wrong with explicitly stating semicolons there and using none by default? (Especially if the code is short enough that it's easy to test and doesn't require multiple maintainers, like here)

Absolutely nothing wrong with that. Just that a lot of newer JS devs won't even know those edge cases exist. Someone needs to be the "um ackshually 🤓" when semicolons are mentioned or else those new devs reading will assume there's 0 functional difference between using or not using semicolons in JS.

§
Δημοσιεύτηκε: 26/11/2022
Absolutely nothing wrong with that. Just that a lot of newer JS devs won't even know those edge cases exist. Someone needs to be the "um ackshually 🤓" when semicolons are mentioned or else those new devs reading will assume there's 0 functional difference between using or not using semicolons in JS.

Ah, that makes sense. Yeah, when you're completely new to a topic, it's hard to pick out which things to take at face value and which are counterintuitive

UnmatchedBracketΔημιουργός
§
Δημοσιεύτηκε: 26/11/2022

Honestly i just do it cuz i usually use python and i'm too lazy to add semicolons

And when it breaks occasionally i add it then

Δημοσίευση απάντησης

Συνδεθείτε για να δημοσιεύσετε μια απάντηση.