Let variable and why you would change something

I am not stuck I just don’t understand the purpose of let.
My code works fine I just don’t understnad why you would write a change in a variable, RIGHT bellow the one that is already there. Isn’t that just unorganized? Why wouldn’t you just change the original code?

sometimes, a lesson teaches a concept (in this case, updating variable), which is a very useful concept, for the simple reason that we can’t always rewrite the code.

look at this bin:


its some simple JS code (press the run button in top right to run the code), we ask the user for input, and then converting this input to lowercase. We can’t rewrite the code, because we don’t know what the user will enter.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.