Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Immanuel Jaeggi5,164 Points
Somethings are not fully understandable in this video
I understood that the prompt("What`s your name"); gets visitors to type their name in, and that the variable visitorName stores only their name.
In this case, the following code will first prompt the user for their name, then display their name in the alert box.
var visitorName = prompt("What is your name?"); alert(visitorName);
My question is, why would they want to see their name again just after typing it in?
And why would I want to use the console.log to see the user`s name in the JS console?
Max Senden23,177 Points
Max Senden I wanted to ask on 1:50 the instructor said something I didn't quite catch, something about a variable returning a value I don't understand what he meant and Im curious??
@Lucas Leniek he said that the prompt command returns a value, which is whatever the person type in the prompt that appears when the command runs. This value needs to go somewhere, so we store it inside of a variable. In other words, we program a variable to receive whatever the person types in the prompt thing. Hope it helps.