Popup boxes (or dialog boxes) are modal windows used to notify or warn the user, or to get input from the user.
Popup boxes prevent the user from accessing other aspects of a program until the popup is closed, so they should not be overused.
There are three different kinds of popup methods used in JavaScript: <ahref='https://developer.mozilla.org/en-US/docs/Web/API/Window/alert'target='_blank'rel='nofollow'>window.alert()</a>, <ahref='https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm'target='_blank'rel='nofollow'>window.confirm()</a> and <ahref='https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt'target='_blank'rel='nofollow'>window.prompt()</a>.
### Alert
The <ahref='https://developer.mozilla.org/en-US/docs/Web/API/Window/alert'target='_blank'rel='nofollow'>alert method</a> displays messages that don't require the user to enter a response. Once this function is called, an alert dialog box will appear with the specified (optional) message. Users will be required to confirm the message before the alert goes away.
The <ahref='https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm'target='_blank'rel='nofollow'>confirm method</a> is similar to `window.alert()`, but also displays a cancel button in the popup. The buttons return boolean values: true for OK and false for Cancel.
The <ahref='https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt'target='_blank'rel='nofollow'>prompt method</a> is typically used to get text input from the user. This function can take two arguments, both of which are optional: a message to display to the user and a default value to display in the text field.
If you are unhappy with the default JavaScript popups, you can substitute in various UI libraries. For example, SweetAlert provides a nice replacement for standard JavaScript modals. You can include it in your HTML via a CDN (content delivery network) and begin use.