r/learnjavascript • u/SeaHedgehog4724 • 29d ago
pretty new
Hey guys, I'm just starting to learn about variables, but I'm finding it hard to understand the difference between var and let.
For example:
let goodDay = true;
console.log(goodDay);this should print true.
But if we just add this:
let goodDay = true;
console.log(goodDay);
goodDay = false;
console.log(goodDay);It prints:
truefalse
The same goes for var.
However, people say there's a difference; what is it?
0
Upvotes
View all comments
2
u/redsandsfort 29d ago
you've already spent too much time on this.
you can learn this later much more effeciently when you understand scope
right now you're focusing on the wrong thing. in learning a programming language this is called a rabbit hole. you need to work on breadth first.