Account
Categories

confirm()


Definition:

If you use this function in a program, it displays a pop-up box with a message and two buttons: OK and Cancel.

The user can choose the Yes (OK) or No (Cancel) button.

Now you will clearly understand with the help of the flowchart.

Start
  |
  v
Browser shows confirm() pop-up
  |
  v
User clicks a button
  |
  |-- OK ---------> Return true
  |
  |-- Cancel -----> Return false
  |
  v
End
  

Syntax:

confirm("message");

Example:

let choice = confirm("Do you like www.edutation.com");

Output: