The confirm() method is used to display a dialog box with a message, OK button, and Cancel button. It returns true if the user clicked on the OK button else it will return false. It is often used if we want the user to verify or accept something. It takes the focus away from the current window and forces the user to read the message.
Its syntax is:- confirm(message)
Its return is:- true if the user clicked OK else false
|message||Optional. The text that we want to display in the confirm box.|