Comment

Comment by jpcrs

I don't know why so many people are saying that this is bad code.

Besides the redundant checks, it's really simple, so simple that an intern, maybe even someone who doesn't code, can understand and update it.

It's performant, most compilers will cache the strings.

People trying to justify more complex one-liners with "what if you change the symbol, or just show 5 characters" etc. These scenarios wouldn't take more than 5 minutes to adapt this code, and anyone could do it.

For me, this code with a good set of tests doesn't get much better.

parent jpcrs 3 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton