Y
Hacker News
new
|
ask
|
show
|
jobs
by
canacrypto
2502 days ago
I've found it's better to write normal conditions that are easier to read and leave it to your linter to catch unintended assignments.
1 comments
thomasahle
2502 days ago
Are they really easier to read though? A lot of the time which variable being tested is obvious, so it makes sense to put the important information - the value - first.
link
jonny_eh
2502 days ago
> so it makes sense to put the important information
Both sides of the equality check are equally important.
link
TheSoftwareGuy
2502 days ago
I think he should have written "it makes sense to put the non-obvious information first" as it contrasts better with the first part of the sentence
link