These alerts should be used sparingly. When used in excess, users become generally annoyed with them. The use of the popups is generally acceptable in these types of situations:
An error has occurred and you want to inform the user of the problem.Asking users for confirmation before a specific action is taken to validate their input.
JavaScript has three kinds of popups: Alert, Confirm, and Prompt.
Alert Popup
An alert popup is used if you want to provide the user with some information that is important to know about. When an alert popup is initiated, the user will have to click OK to proceed. The alert() method is supported by all major browsers. Here is an example of how to use the alert() method.
Confirm Popup
The confirm popup is similar to the alert popup but provides the user with a choice. The user can either confirm by clicking on OK, or the user can click on the Cancel button to cancel the request. OK returns true and cancel returns false, back to the JavaScript code block. The confirm() method is supported by all major browsers. Here is an example of how to use the confirm() method.
Prompt Popup
The prompt popup box is rarely implemented these days. In the early days of web development, the prompt popup was used to collect information from the user. Modern web development techniques would not include the use of this method to collect information. Interaction with the user is normally done through input elements and server side scripting handles the processing of the data provided by the user. In any case, you should be aware of the syntax and use of this method. The prompt() method is supported by all major browsers. Here is an example of how to use the prompt() method.