Ask coding questions

← Back to all posts
How can I make it so the user can pick a name for something and the computer will remember that name
seth08g (1)

In my code I need to make it so the user can name something and the computer says 'blank, that's a great name!'
please help thanks..

Answered by Coder100 (18934) [earned 5 cycles]
View Answer
Coder100 (18934)

You could assign the user input into a variable.

Maybe something like:

let name = prompt("username");

By the way, I recommend actually adding semicolons to hide you from tricking js rules!

seth08g (1)

thanks for the advice

seth08g (1)

why do you use semicolons?