Обробка винятків
try {
adddlert("Welcome guest!"); // adddlert is not defined
}
catch(err) {
document.getElementById("demo").innerHTML = err.message;
}
txt = "There was an error on this page.\n\n";
if(!confirm(txt)) {
document.location.href = "https://www.w3schools.com/";
}