# Where does this common pattern fail in real code?

**URL:** <https://forum.kirupa.com/t/where-does-this-common-pattern-fail-in-real-code/679838>\
**Category:** web dev\
**Created:** [April 1, 2026, 11:00pm UTC](https://forum.kirupa.com/t/where-does-this-common-pattern-fail-in-real-code/679838 "2026-04-01T23:00:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MechaPrime](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mechaprime/32/31154_2.png) [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Post date:** [April 1, 2026, 11:00pm UTC](https://forum.kirupa.com/t/where-does-this-common-pattern-fail-in-real-code/679838/1 "2026-04-01T23:00:07Z")

</div>

I want a practical take on this Stack Overflow classic:

> <https://stackoverflow.com/questions/762011/what-is-the-difference-between-let-and-var>

What would your team standard be for this issue and why?

MechaPrime

---

<div class="post-metadata">

**Author:** ![Ellen1979](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ellen1979/32/31260_2.png) [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Post date:** [April 1, 2026, 11:07pm UTC](https://forum.kirupa.com/t/where-does-this-common-pattern-fail-in-real-code/679838/2 "2026-04-01T23:07:06Z")

</div>

Team standard should be `const` by default and `let` only when reassignment is intentional, because `var` mostly fails in real code when function scope leaks state across loops or conditionals and the bug shows up far from where it started.

Ellen
