codetelo
1 min readNov 17, 2022

Here are my thoughts on the article:

1. I would always prefer that developers focus on readability first. The double tilde `~~` has negligible performance increase until you get to insanely large numbers and it decreases readability. We can read math.round(or floor or ceil) and know exactly what the intention is behind it. I think this article does a good job explaining the issues with this method: https://www.jstips.co/en/javascript/rounding-the-fast-way/

2. Definitely a good option if you are approaching a very large dataset.

3. I have a preference for Object Literals over switch statements. I think they are more readable and roughly as performant. The main issue with Object Literals is that they don't catch default cases, so you'll have to handle that separately or include cases for undefined, null, etc. https://www.measurethat.net/Benchmarks/Show/3444/0/switch-vs-object-literal

4. I love short-circuit conditionals, but we just have to make sure we don't get too carried away with them. I definitely use it in JSX sometimes. They are great for small things like what you've presented, but if you have more than a single line of code it can reduce readability.

5. Completely agree with this. Typescript would also help a lot with ensuring that the developer knows whether or not the value is required.

Great article. Just my two cents on my preferences and what I like to see in the code bases I've worked in over the years.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

codetelo
codetelo

Written by codetelo

Full Stack Software Engineer | Tech Lead | Typescript | React | AWS

No responses yet

Write a response