4 views

1 Answers

Use "prompt(text);". It opens a window with a text field and shows the text that is inside the (). For instance, if you have a variable called foo and you want to set its value to something the users inputs, such as their username, you might do this: foo = prompt("Enter your username:") or, if you haven't defined foo already, var foo = prompt("Enter your username:").

4 views