I didn't get it...
This is ECourses Progress Report 2, and you're witnessing AI taking over.
When I was having Claude writing three separate forms, routes and actions based on my previous code...
I stumbled upon something outrageous,
let retries = 0;
What is it? ā I don't know, truly...
Basically, there are two ways to store data in JavaScript, in-fact everywhere
- Constants and
- Variables
While declaring constants is pretty straight forward,
variables can be declared in two ways,
using let and var
For years, var has dominated the JavaScript files until let stepped in.
Why?
var has a major risk. It is Function-based Scoped. (maybe I spelled it wrong)
BTW, the meaning is that once a variable is declared with var:
var retries = 0;
We can access the retries variable anywhere inside the function, this poses a threat in some cases.
While, using let for the same thing would restrict its scope to the parent code block i.e. curly braces { & }
There is more to it.
HOISTING !!!!!
The legendary NIGHTMARE for interviewee (Hope it is correct...)
So, var initializes the variable with null or undefined, while let stores it inside a Dead Zone the variable does not get initialized unless you do so...
The era of var came to an end,
And now, most files are dominated with let
Summary: ECourses is progressing butterly smooth...
Top comments (0)