Hide full rooms - bonk.io

Hides rooms that are full in bonk.io.

< 腳本Hide full rooms - bonk.io的回應

提問/評論

§
發表於:2022-11-22

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

§
發表於:2022-11-22

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.

§
發表於:2022-11-23
編輯:2022-11-23

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)

§
發表於:2022-11-26

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.

§
發表於:2022-11-26
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

§
發表於:2022-11-26

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

發表回覆

登入以回復