Live data from Hacker News

Can You Find the Bug in This Code?

victorzhou.com

1–10 of 64 posts

Re: Can You Find the Bug in This Code?

#3
I feel good that my first thought of fixing it would have created the solution.

There were obvious errors in my mind that I would fix without knowing the whole dissertation on why it happened.

So maybe if the question was, "Can you repair this code", I would excel.

Re: Can You Find the Bug in This Code?

#5
Semicolons are usually optional in JS. The 'usually' part if why it's a good idea to enforce usage of them to avoid situations like this. You don't even need to do IEEs for this - running a function on an inline-declared array has a high probability of creeping the array up as an index on the previous expression.

Re: Can You Find the Bug in This Code?

#10
I refuse to use semi-colons in TS/JS, unless that conflicts with existing code standards. I feel like it's as if I'm using semi-colons in Go. This can easily be avoided by writing clearer code.
Post reply on HN