In the scope of this tutorial, we are going to show how you can create a modal dialog with an optional message and “OK” and “Cancel” buttons.
The confirm() method
The Window.confirm() method displays a modal dialog with an optional message and “OK” and “Cancel” buttons. The message is an optional string that is displayed in the dialog, and the result is a boolean, which indicates whether OK (true) or Cancel (false) was selected. If a browser is ignoring in-page dialogs, then the result is always false.