Yvzslm Posted October 14, 2016 Share Posted October 14, 2016 Greetings! I do not understand why I have to describe that variable " ". http://www.w3schools.com/js/tryit.asp?filename=tryjs_loop_for_ex When I put a letter in it, it returns "aThe number is 0 (...)" only the first character, not every loop. So why we need to describe empty value. Why we want to write there nothing -> Link to comment Share on other sites More sharing options...
dsonesuk Posted October 14, 2016 Share Posted October 14, 2016 See what happens if you remove it, then you will know WHY it is required. Its asking to join current value to previous. Link to comment Share on other sites More sharing options...
Ingolme Posted October 14, 2016 Share Posted October 14, 2016 That line of code creates the variable (reserves space in the computer's memory) and tells it to be a string with no content in it. As dsonsuk said, try removing that line and see what shows up in the browser's Javascript console (most browsers let you access the console by pressing F12) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now