<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en" -->

---
title: Javascript Worst Practice. Bad coding habits you need to...
description: Fernando Doglio takes a look at 5 of the worst things you can do to your code while writing JavaScript. Not everyone is fully aware that 2 + &#x27;2&#x27; is not going...
canonical: https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Javascript Worst Practice. Bad coding habits you need to stop… | daily.dev
og:description: Fernando Doglio takes a look at 5 of the worst things you can do to your code while writing JavaScript. Not everyone is fully aware that 2 + &#x27;2&#x27; is not going...
og:url: https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en
og:image: https://api.daily.dev/og/posts/smTLr6-en.png
og:image:alt: Javascript Worst Practice. Bad coding habits you need to stop…
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.

# Javascript Worst Practice. Bad coding habits you need to stop…

**[Bits and Pieces](https://daily.dev/sources/bit)** · [@deleteman](https://daily.dev/deleteman) · 2 min read · 139 upvotes · 6 comments

## Summary

Fernando Doglio takes a look at 5 of the worst things you can do to your code while writing JavaScript. Not everyone is fully aware that 2 + '2' is not going to be 4. And that the type of [] + 1 is neither Number nor Array. Build independent components for speed and scale.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.bitsrc.io/javascript-worst-practices-dc78e19d6f12>

## Community discussion

Top comments from developers on daily.dev.

**@matt\_stuart** · 2 upvotes

> The memory leak part of this was particularly good! Would definitely dive deeper into that part

**@shivi\_choudhary** · 1 upvotes

> super hot 🔥🔥🔥🔥 post

**@joaooliveira85** · 1 upvotes

> Very interesting article. I'd say it's a good read for junior devs but, to be honest, I think a lot of people would benefit from this.

**@saqibjamil** · 0 upvotes

> Helpful

**@mhbaando** · 0 upvotes

> thnks for sharing it

## 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

---

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

[View this post on daily.dev](https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en)

```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":"Javascript Worst Practice. Bad coding habits you need to stop…","url":"https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en"},"datePublished":"2021-09-27T18:07:24.404Z","dateModified":"2021-10-07T14:17:10.317Z","description":"Fernando Doglio takes a look at 5 of the worst things you can do to your code while writing JavaScript. Not everyone is fully aware that 2 + '2' is not going...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ae1a7f2a0dee4c8995f7e6d4f741d1d5","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ae1a7f2a0dee4c8995f7e6d4f741d1d5","isAccessibleForFree":true,"articleSection":"Bits and Pieces","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":"Person","name":"Fernando Doglio","url":"https://daily.dev/deleteman","image":"https://lh3.googleusercontent.com/a-/AOh14GjHsDw4rFN2nL_hd2xOYBiV-CoIY2zVUYgMN8Mebw=s100","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":1660}},"commentCount":6,"discussionUrl":"https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":139},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":6}],"keywords":"javascript","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Bits and Pieces","item":"https://daily.dev/sources/bit"},{"@type":"ListItem","position":3,"name":"Javascript Worst Practice. Bad coding habits you need to stop…"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/javascript-worst-practice-bad-coding-habits-you-need-to-stop--smtlr6-en","comment":[{"@type":"Comment","text":"The memory leak part of this was particularly good! Would definitely dive deeper into that part","datePublished":"2021-09-27T20:20:18.986Z","url":"https://daily.dev/posts/smTLr6-en#c-fQJwnhmv1","author":{"@type":"Person","name":"Matt","url":"https://daily.dev/matt_stuart","image":"https://lh3.googleusercontent.com/a-/AOh14Gh93krENlYWLxCiUrqZEizW6GzbjAZLbxT5w4P_=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"super hot 🔥🔥🔥🔥 post","datePublished":"2021-09-28T03:26:09.796Z","url":"https://daily.dev/posts/smTLr6-en#c-G1B3PC6iY","author":{"@type":"Person","name":"Shivi_codes","url":"https://daily.dev/shivi_choudhary","image":"https://avatars.githubusercontent.com/u/34636947?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Very interesting article. I’d say it’s a good read for junior devs but, to be honest, I think a lot of people would benefit from this.","datePublished":"2021-09-28T12:13:26.002Z","url":"https://daily.dev/posts/smTLr6-en#c-OTTYhWJ06","author":{"@type":"Person","name":"João Pedro Oliveira","url":"https://daily.dev/joaooliveira85","image":"https://avatars.githubusercontent.com/u/24904733?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Helpful","datePublished":"2021-10-21T16:18:17.703Z","url":"https://daily.dev/posts/smTLr6-en#c-3UIRpZpE_","author":{"@type":"Person","name":"Saqib Jamil","url":"https://daily.dev/saqibjamil","image":"https://lh3.googleusercontent.com/a-/AOh14GhOlZIN1Cw9V_jQidKMzOs2Auf4O7vHwYBEGzvuQw=s100"}},{"@type":"Comment","text":"thnks for sharing it","datePublished":"2021-11-03T13:10:55.834Z","url":"https://daily.dev/posts/smTLr6-en#c-_IZ7-hg2S","author":{"@type":"Person","name":"Mohamud A. Abshir","url":"https://daily.dev/mhbaando","image":"https://avatars.githubusercontent.com/u/85341288?v=4"}}]}
```

