Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

If the user presses “ok” in the dialog box then what will be the output of the following JavaScript code?
function msg()
{
var v= confirm(“Are u sure?”);
if(v==true)
{
alert(“yes”);
}
else
{
alert(“no”);
}
}

If the user presses “ok” in the dialog box then what will be the output of the following JavaScript code?
function msg()
{
var v= confirm(“Are u sure?”);
if(v==true)
{
alert(“yes”);
}
else
{
alert(“no”);
}
}
a) true
b) false
c) no
d) undefined

Answer: b
Explanation: The function confirm is present in the window object. confirm() method displays the confirm dialog box containing a message with ok and cancel button.

Join The Discussion