Question about initialized and uninitialized variables in JavaScript

Does initialized mean if variable is a number and uninitialized if variable isnt a number but a string instead?

So uninitalized means if variable has no value basicaly? And also undefinited variable is the one without number but with a string instead?

This seems somewhat confusing to me, im gonna use some youtube tutorials for beginners in javascript. Thank you for help regardless, i will come back after i get more into this, since html and css were quiet easy to learn, same goes for jquey and bootstrap, which are all basically designs, its time to move to web sites functions and this will take me way more time to comprehend.

Im still confused about undefined variable, it seems easy but hard to grasp what it would exactly mean. Does it mean for example if var has no name given? Thats one thing im thinking considering the word undefined, since we define variable with some name.

I always viewed the initial value of a variable declaration of var to be undefined. Any user defined value happened to be an assignment. I suppose you can see it in terms of implicit or explicit initialization; I’m not sure how much weight my opinion is shared within the JavaScript community though.

This “undefined” JS is actually quite simple to learn & initiate once you read the problem well.

Just some feedback for FCC. I think that many of the lessons so far have way too much information. Many times the examples are nothing like the final answers. I am sure by design. But it does hinder progress.

What happens if I try to do an operation on an uninitialized variable?

Say, concatenate it with a string, increment it, or use it as a counter in a loop

it will start with undefined, so you may find that it results in NaN or a string with at the beginning the word “undefined”. try, you will see…

1 Like