Edit in JSFiddle

<button onclick="myAlertBox()">Try Alert Box</button>
<button onclick="myConfirmBox()">Try Confirm Box</button>
<button onclick="myPromptBox()">Try Prompt Box</button>
function myAlertBox() {
    alert("My Alert box!");
}

function myConfirmBox() {
        var result =confirm("My Confirm box!");
    if (result == true) {
      alert("You pressed OK!");
      } else {
            alert("You pressed Cancel!");
        
      } 
    }
    
function myPromptBox() {
        var result = prompt("My Prompt box!","Default Value");
  if (result != null) {
      alert("Hello " + result + "!");
      } else {
            alert("You pressed Cancel!");
        
      } 
    }