Examples of using let variable in basic projects

I’m currently learning about let variables and am a little bit confused about ways to use them. What would be a good reason/example to not assign a value to a variable name using let, and then later assign a value to that variable name?


let changeMe = true; changeMe = false; console.log(changeMe);

One example I can think of is if you are using the let variable to store ‘string’ data-type, you can just declare the variable without a value, then later you can assign it to string data-type value.

let myString; myString = "some string"; console.log(myString) //expected output: some string
1 Like

ahh okay, I appreciate the help!

1 Like

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