# Questioning the function of "let" when declaring a variable

**URL:** <https://discourse.processing.org/t/questioning-the-function-of-let-when-declaring-a-variable/47083>\
**Category:** Beginners\
**Created:** [September 5, 2025, 1:22am UTC](https://discourse.processing.org/t/questioning-the-function-of-let-when-declaring-a-variable/47083 "2025-09-05T01:22:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [September 5, 2025, 1:42am UTC](https://discourse.processing.org/t/questioning-the-function-of-let-when-declaring-a-variable/47083/2 "2025-09-05T01:42:41Z")

</div>

By default, JS code run by a browser uses the “sloppy mode”, which doesn’t require a variable to be declared before using it:

> [@Let or nothing?](https://discourse.processing.org/t/let-or-nothing/46937/2):
>
> That behavior is nicknamed “sloppy mode”: In order to activate [“strict mode”](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode), place "use strict"; as the 1st non-comment statement in a JS file. We can also activate “strict mode” by loading a JS file as an [“ECMA script module (ESM)”](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type#module).

BtW, JS got various keyword commands which can be used to declare a variable:  
var, let, const, function, class, import.

---

_[View the full topic](https://discourse.processing.org/t/questioning-the-function-of-let-when-declaring-a-variable/47083)._
