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:

prompt(message,defaultString);

Example for prompt function:

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