Alert and Confirm Behaviour

by Rupesh Kokal

HTML

<button>Show Alerts</button>

JavaScript

function showAlerts()
{
    alert("1");
    alert("2");
    
    if (confirm("confirm 1")==true)
    {
        console.log("confirm 1 = true");
    }
    else
    {
        console.log("confirm 1 = false");
    }
    
    if (confirm("confirm 2")==true)
    {
        console.log("confirm 2 = true");
    }
    else
    {
        console.log("confirm 2 = false");
    }
}

$("button").click(function(){
    showAlerts();
});