How do you confirm a dialog?


how do you confirm a dialog?


When you click ok or cancel when using the prompt dialog to let your program know what the user wants.

In situations like below:

 function getConfirmation(){
           var retVal = confirm("Do you want to continue ?");
           if( retVal == true ){
              console.log("User wants to continue!");
              return true;
              console.log("User does not want to continue!");
              return false;


by using e.g.


where "Text" is the message that the user sees in the pop-up box. If you press ok this means true if you press cancel this means false and this true or false value can be used either in a condition or stored in a variable.

@devfox maybe use an example that is runable :smile:


Fixed it! :stuck_out_tongue_winking_eye:


Ok, thank you. Also maybe get rid of the document.write as this track is console only. Also: