You can create a JavaScript confirmation box that offers “yes” and “no” options by using the confirm() method. The confirm() method will display a dialog box with a custom message that you can specify as its parameter. The dialog will also have “OK” and “Cancel” buttons, which return the boolean value true or false .