javascript confirmation alert code example
Example 1: alert confirm prompt javascript
if (confirm("Press a button!")) {
console.log("Accepted")
} else {
console.log("Declined")
}
Example 2: javascript prompt
var person = prompt("Please enter your name", "Harry Potter");
if (person != null) {
document.getElementById("demo").innerHTML =
"Hello " + person + "! How are you today?";
}
Example 3: javascript alert
alert("string");