---
title: "Discussion on \"5 Tips for Writing Cleaner Code\" | Hashnode"
description: "Discussion on \"5 Tips for Writing Cleaner Code\". Prevent unnecessary nesting\n\n\nToo much nesting can make the code harder to read and more prone to errors, so we can return early to avoid excessive nesting.\n// Bad\nfunction deleteItem(item) {\n  if (item != null) {\n    console.log('Deleting item');\n  ..."
url: "https://hashnode.com/posts/5-tips-for-writing-cleaner-code/63e7d0f9ef45f3058b1ba22c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [5 Tips for Writing Cleaner Code](https://shineve.hashnode.dev/5-tips-for-writing-cleaner-code?utm_source=hashnode&utm_medium=feed)

Prevent unnecessary nesting Too much nesting can make the code harder to read and more prone to errors, so we can return early to avoid excessive nesting. // Bad function deleteItem(item) { if (item != null) { console.log('Deleting item'); ...

Feb 11, 2023 · 3 min read · shineve.hashnode.dev  
Updated Feb 28, 2023  
Read the article

-   [#frontend-development](https://hashnode.com/tag/frontend-development)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#typescript](https://hashnode.com/tag/typescript)

## Written by

[Ting Hao](https://hashnode.com/@shineve)

@shineve · Taipei, Taiwan

  
[View profile](https://hashnode.com/@shineve)

Front-End Engineer

Malaysian, Front-End Engineer currently staying in Taiwan.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
