<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs" -->

---
title: Patterns and Anti-patterns in Node.js | daily.dev
description: There are two ways to declare variables in JavaScript: var and let. var declares a function-scoped variable (when declared within a function) Let and const...
canonical: https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Patterns and Anti-patterns in Node.js | daily.dev
og:description: There are two ways to declare variables in JavaScript: var and let. var declares a function-scoped variable (when declared within a function) Let and const...
og:url: https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs
og:image: https://api.daily.dev/og/posts/l6HUH5Lvs.png
og:image:alt: Patterns and Anti-patterns in Node.js
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.

# Patterns and Anti-patterns in Node.js

**[AppSignal](https://daily.dev/sources/appsignal)** · 3 min read · 58 upvotes · 1 comments

## Summary

There are two ways to declare variables in JavaScript: var and let. var declares a function-scoped variable (when declared within a function) Let and const declare block- scoped variables. With let and const, you won't be able to use a variable that has not been declared.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.appsignal.com/2022/02/23/patterns-and-anti-patterns-in-nodejs.html>

## Community discussion

Top comments from developers on daily.dev.

**@zi683** · 0 upvotes

> Very succinct!

## 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: [#general-programming](https://daily.dev/tags/general-programming), [#logging](https://daily.dev/tags/logging), [#nodejs](https://daily.dev/tags/nodejs)

[View this post on daily.dev](https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs)

```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":"Patterns and Anti-patterns in Node.js","url":"https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs"},"datePublished":"2022-02-23T13:01:26.717Z","dateModified":"2026-03-15T03:16:21.886Z","description":"There are two ways to declare variables in JavaScript: var and let. var declares a function-scoped variable (when declared within a function) Let and const...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/15c1798cc90c6faad27fbcd349d90877","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/15c1798cc90c6faad27fbcd349d90877","isAccessibleForFree":true,"articleSection":"AppSignal","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":"AppSignal","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/60b55a8dfc5448bd9daad08aea11a7a3","url":"https://daily.dev/sources/appsignal"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":58},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"general-programming,logging,nodejs","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AppSignal","item":"https://daily.dev/sources/appsignal"},{"@type":"ListItem","position":3,"name":"Patterns and Anti-patterns in Node.js"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/patterns-and-anti-patterns-in-node-js-l6huh5lvs","comment":[{"@type":"Comment","text":"Very succinct!","datePublished":"2022-02-26T03:57:07.443Z","url":"https://daily.dev/posts/l6HUH5Lvs#c-2DxxZEg17","author":{"@type":"Person","name":"Zi T","url":"https://daily.dev/zi683","image":"https://media.daily.dev/image/upload/f_auto/v1642151480/avatars/njMmEur4NWz7IbWMTNMLM"}}]}
```

