alert, prompt and confirm in JavaScript
alert("Enter the value of a");
let a = prompt("Enter value of a : ", "522");
a = Number.parseInt(a);
//document.write("The value of a is : " + a);
alert("You entered a of type " + (typeof a));
let write = confirm("Do you want to write it to the page ?");
if (write) {
document.write("You entered : " + a);
}
else {
document.write("Please allow me to write");
}





Comments
Post a Comment