Overview. The JavaScript window. prompt() is a built-in function that is used to display a dialog box that asks the user to input some text. This pop-up box will appear and takes user input before entering the web page. It waits until the user enters any value in the text box or we can also cancel the dialog box.