I’ve been doing a lot of code reviews lately. Here are few snippets that help share the learnings
I’ve never seen this argument raised before. I’m talking about empty statements with just semicolons.
And before you think it was just for chained function calls, you’d be wrong.
Here is how the discussion went.
Me: No one else does it.
Dev: Doesn’t mean we shouldn’t do it.
Me: Its needless
Dev: Are semicolons useless
Me: No but put them on the line before if want them
Dev: But then I have to move it if I want to do something new
….. long pause …
The lesson I got for this was that sometimes an executive decision is the right answer. I challenge you to come up with an answer for this question and try to rationalize it.
The dev did agree to this eventually. He values consistency and I used that as an argument. Here is the code snippet I used:
var foo;
; // maybe a new line is needed at some point
var bar;
;
moreCode();
;