Closed Zidail closed 8 years ago
I don't find these changes to improve the code, sorry.
No problem @ide. Just out of curiosity, could you tell me why you'd prefer to keep them as let
s rather than swap them to const
s?
const
doesn't really offer more than let
in this case. At the level of individual functions it's not a problem to see if something gets reassigned or not, your brain has enough "RAM" to think about the whole function without const vs. let being that helpful. So then I find that mixing const
and let
in the same function makes it harder to read because syntactically there's extra visual complexity because const and let are different lengths -- one study showed that visual alignment of code was one of the things that makes it easier to read -- and if you make a change to the code in the future that adds/removes reassignment you need to change const
to let
or vice versa and I find the cost of that thrash higher than the benefit from the info that const
or let
communicates.
Thanks for taking the time out to explain this. I see what you mean. It's always good to hear another developer's perspective.
systemButtonOpacity
part of the component rather than letting it float outsidecomputeActiveOpacity
method