15
Saw a bunch of beginners using let when const was the right call
Been scanning some code on GitHub the past few weeks. Every other new project has let everywhere. Even for stuff that never changes. I get it, let works. But const tells the next person your intent. Saves headaches later. I learned that the hard way after a bug took me 2 hours to find because I reassigned something on accident. Anyone else notice this pattern?
3 comments
Log in to join the discussion
Log In3 Comments
mila_harris4d ago
Learned that lesson after accidentally redeclaring a variable and spending an hour blaming my cat.
7
norab214d ago
Pretty sure your cat did it though right
9
shane_fisher374d ago
Eh, I kind of disagree. Usually it's me forgetting to save or closing the wrong tab. My cat just sits there looking innocent.
0