var for the win! I don’t care if it’s outdated or messes up in the global scope; it wOOORKS!
Wait please don’t tell me you actually use
I do all the time. And before you lecture me on how let is better, I don’t care.
Well you see,
let is easier to type.
There, that’s the end of my lecture.
21 posts were split to a new topic: What fingures do you use to type?
I was just writing some JS, and I wrote var, but just for you guys I changed them to let.
The only reason I use
var is because it has an actual meaning
well, I did use var for a long time until I found scopes. Ever since, I’ve limited myself to let, const, and window.variableName, only using var in stuff I don’t care about. Using let/const helps me reduce the probability that I redefine an active variable as something else, causing an error in some other section of code.
I’m kinda weird because I use all three.
constfor node (like port numbers) and also for variables that will stay the same throughout the program.
varfor variables that will change value in the program
letfor scopes and stuff (mainly global)
And in terms of typing ease,
let can be faster but uses 2 hands. However
var is slightly slower for me but it only uses 1 hand.
let also forms a sentence so it’s easier to read. You
let a variable be a value. Simple as that.
I think it’s like that in regular math too, like “let x be 4”