The javascript prompt() is a method of the window object, just like alert() or confirm().
The point of the JavaScript prompt is to get information from the user before entering a page so that the information can be used throughout the site to give the visitor a personalized feel.
When a prompt box pops up, the user will have to click either “OK” or “Cancel” to proceed after entering an input value in the text field. JavaScript lets you specify a default value for this text field.
prompt(”Question”, “default value in the text field”);
If the user clicks “OK” the box returns the input value. If the user clicks “Cancel” the box returns null. The information submitted by the visitor from prompt() can be stored in a variable.