1. Prompt function in javascript used for taking an input from users.
2. Prompt function displays a popup box which contains a text box, OK and Cancel buttons.
3. When user clicks on OK button, prompt function returns value present in text box.
4. When user clicks on cancel button, prompt function returns a null value.

Syntax for prompt function:


Example for prompt function:

var op=prompt('enter a number','10');
Note: It is highly recommended to not use prompt function as the popup boxes destroys user's satisfaction.