---
title: "Discussion on \"The Difference Between var, let, and const in JavaScript\" | Hashnode"
description: "Discussion on \"The Difference Between var, let, and const in JavaScript\". Variable declaration keywords in JavaScript can seem like the Spider-Man meme.\nTL;DR\n\nJavaScript has a unique history which has contributed to its confusing features and structure.\nWhen considering when to use var, let, or const, you must take into c..."
url: "https://hashnode.com/posts/the-difference-between-var-let-and-const-in-javascript/6241164fca2371befe7e9d34"
---

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

Discussion

# [The Difference Between var, let, and const in JavaScript](https://mjstromberg.hashnode.dev/the-difference-between-var-let-and-const-in-javascript?utm_source=hashnode&utm_medium=feed)

Variable declaration keywords in JavaScript can seem like the Spider-Man meme. TL;DR JavaScript has a unique history which has contributed to its confusing features and structure. When considering when to use var, let, or const, you must take into c...

Mar 28, 2022 · 9 min read · mjstromberg.hashnode.dev  
Updated May 13, 2022  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#software-engineering](https://hashnode.com/tag/software-engineering)
-   [#programming](https://hashnode.com/tag/programming)
-   [#variables](https://hashnode.com/tag/variables)
-   [#bootcamp](https://hashnode.com/tag/bootcamp)

## Written by

[Michael Stromberg](https://hashnode.com/@mjstromberg)

@mjstromberg

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

Former mechanical engineer, current software engineer, and future ninjaneer.

## Responses 1

Markdown supported · ⌘↵ to post

[ProfOnestone](https://hashnode.com/@ProfOnestone)

[Mar 28, 2022](https://hashnode.com/posts/the-difference-between-var-let-and-const-in-javascript/6241164fca2371befe7e9d34/comment/62415d059dbbe8c3bace25ee)

Thanks for sharing this,

var and const were pretty clear to me but now I get the usage of let as well.

Just curious, is there any significant performance benefit in using let over var ? E.g. in a function where you have to declare some variables along the way.

[Michael Stromberg](https://hashnode.com/@mjstromberg)

[Mar 28, 2022](https://hashnode.com/posts/the-difference-between-var-let-and-const-in-javascript/6241164fca2371befe7e9d34/comment/62415d059dbbe8c3bace25ee#reply-6241db9d1bfa97c5345ea41c)

That's a great question, and I think it would make for an interesting article. Although in my experience, I've found real-world performance testing to be very inconsistent. I suspect they would both perform similarly, but the answer could also be in the ECMAScript specification. Some curious people on Stack Overflow tried their hands at performance testing: [stackoverflow.com/questions/21467642/is-there-a-p…](https://stackoverflow.com/questions/21467642/is-there-a-performance-difference-between-let-and-var-in-javascript)

In the past when performance tuning, I've always found the low-hanging fruit on the UI side. Minimizing unnecessary dependencies, reducing renders, or optimizing the number of network requests were always first on the list. Depending on the application, I'd think these problems are on another order of magnitude impactful than changing the declaration. Hard to say though without context.
