<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9" -->

---
title: Say bye bye to bad javascript practices | daily.dev
description: Some small practices in programming can have a continuously negative impact on the code we write and the product we create as the end result. It’s important to...
canonical: https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Say bye bye to bad javascript practices | daily.dev
og:description: Some small practices in programming can have a continuously negative impact on the code we write and the product we create as the end result. It’s important to...
og:url: https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9
og:image: https://api.daily.dev/og/posts/yrF1PQ4D9.png
og:image:alt: Say bye bye to bad javascript practices
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Say bye bye to bad javascript practices

**[Medium](https://daily.dev/sources/medium_js)** · 4 min read · 673 upvotes · 66 comments

## Summary

Some small practices in programming can have a continuously negative impact on the code we write and the product we create as the end result. It’s important to share what they are and why you should avoid them at all costs. Here are a few tips and reminders to help you write code comments like a pro.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.gogrow.dev/say-bye-bye-to-bad-javascript-practices-5971688ba80a?source=rss------javascript-5>

## Community discussion

Top comments from developers on daily.dev.

**@star\_knight\_\_\_** · 5 upvotes

> I'm currently learning JS, and it's incredibly helpful.

**@flaaj** · 4 upvotes

> I don't agree with number 7.
> Theres nothing wrong with using object as a single input parameter. End of topic.
>
> It's even better to use object if your function has more than 2 parameters. It's more readable, the order of arguments doesn't matter, all your arguments have a key that makes arguments easier to comprehend. Also there's nothing that makes objects more difficult to test than separated parameters

**@manthanank** · 3 upvotes

> Thanks for sharing✌️

**@igoodie** · 3 upvotes

> I recommend `x != null`  instead of what is shown under Section 8. That is both for semantic reasons and error prune solutions.
>
> `x != null` essentially  is the equivalent of `x !== null && x !== undefined`
>
> Consider following example:
> ```js
> const x = something();
>
> // Means if x is not empty, and it is not null and it is not undefined. Too long and creates so much complexity as the post suggests.
> if(x !== "" && x !== null && x !== undefined) {}
>
> // If x is not a falsy value, meaning it ONLY runs for truthy values. But there is a catch, the statement above would not work for the false value...

**@mayank0406984** · 2 upvotes

> The 6 th point was new to me. And this blogs helped me in improving my js knowledge.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Say bye bye to bad javascript practices","url":"https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9"},"datePublished":"2022-11-30T20:01:23.670Z","dateModified":"2022-11-30T20:01:23.668Z","description":"Some small practices in programming can have a continuously negative impact on the code we write and the product we create as the end result. It’s important to...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fbf1ffa1229f06d12bf1f9c631733958","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fbf1ffa1229f06d12bf1f9c631733958","isAccessibleForFree":true,"articleSection":"Medium","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Medium","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/medium","url":"https://daily.dev/sources/medium_js"},"commentCount":66,"discussionUrl":"https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":673},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":66}],"keywords":"javascript","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Medium","item":"https://daily.dev/sources/medium_js"},{"@type":"ListItem","position":3,"name":"Say bye bye to bad javascript practices"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/say-bye-bye-to-bad-javascript-practices-yrf1pq4d9","comment":[{"@type":"Comment","text":"I’m currently learning JS, and it’s incredibly helpful.","datePublished":"2022-12-01T08:37:21.195Z","url":"https://daily.dev/posts/yrF1PQ4D9#c-uuQFeAnc5","author":{"@type":"Person","name":"StarKnight","url":"https://daily.dev/star_knight___","image":"https://avatars.githubusercontent.com/u/92244026?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5}},{"@type":"Comment","text":"I don’t agree with number 7.\nTheres nothing wrong with using object as a single input parameter. End of topic.\nIt’s even better to use object if your function has more than 2 parameters. It’s more readable, the order of arguments doesn’t matter, all your arguments have a key that makes arguments easier to comprehend. Also there’s nothing that makes objects more difficult to test than separated parameters","datePublished":"2022-12-30T12:57:18.657Z","dateModified":"2022-12-30T20:19:42.055Z","url":"https://daily.dev/posts/yrF1PQ4D9#c-Nt7YM9R6g","author":{"@type":"Person","name":"Michał Wołek","url":"https://daily.dev/flaaj","image":"https://lh4.googleusercontent.com/-Ayfk1wi-Y1E/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucksVrwmTdBVXkNuIg_6m54gsuVCOQ/s100/photo.jpg"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4}},{"@type":"Comment","text":"Thanks for sharing✌️","datePublished":"2022-12-01T08:06:58.316Z","url":"https://daily.dev/posts/yrF1PQ4D9#c-N7aFrOHnA","author":{"@type":"Person","name":"Manthan Ankolekar","url":"https://daily.dev/manthanank","image":"https://avatars.githubusercontent.com/u/50883320?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"I recommend x != null  instead of what is shown under Section 8. That is both for semantic reasons and error prune solutions.\nx != null essentially  is the equivalent of x !== null &amp;&amp; x !== undefined\nConsider following example:\nconst x = something();\n\n// Means if x is not empty, and it is not null and it is not undefined. Too long and creates so much complexity as the post suggests.\nif(x !== &quot;&quot; &amp;&amp; x !== null &amp;&amp; x !== undefined) {}\n\n// If x is not a falsy value, meaning it ONLY runs for truthy values. But there is a catch, the statement above would not work for the false value too! So they both semantically mean different things.\nif(!!x) {}\n\n// A semantically better way to maintain such cases is the following:\n// That means, if x exists and it is not an empty string!\nif(x != null &amp;&amp; x !== &quot;&quot;) {}","datePublished":"2022-12-02T11:46:16.338Z","dateModified":"2023-02-22T13:30:54.862Z","url":"https://daily.dev/posts/yrF1PQ4D9#c-Fc5UZVJxN","author":{"@type":"Person","name":"Anılcan Metinyurt","url":"https://daily.dev/igoodie","image":"https://avatars.githubusercontent.com/u/8591785?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"The 6 th point was new to me. And this blogs helped me in improving my js knowledge.","datePublished":"2023-03-17T13:07:59.627Z","url":"https://daily.dev/posts/yrF1PQ4D9#c-38Xo86jRB","author":{"@type":"Person","name":"Mayank Aggarwal","url":"https://daily.dev/mayank0406984","image":"https://lh3.googleusercontent.com/a/AGNmyxYyc1xD7CafZgr_enOSpSP-Xl1y805JS6QlA1X_=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}}]}
```

