1.Confirm function displays a dialog box with a specified message, 
2.Confirm box also displays an OK and a Cancel button.
3.A confirm box is often used if you want the user to verify or accept something.
4.When user clicks on OK button Confirm function returns true, if user clicks on Cancel button the confirm function returns false.
var op=confirm('r u married ?');
 if (op==true)
  alert('you are not a bachelor');
 else if (op==false)
  alert('thank you for being a bachelor');