Computer Science, asked by Aayushijoshi3485, 1 year ago

How to write a global error handler in JavaScript?

Answers

Answered by AryaPriya06
1

<!DOCTYPE html>

<html>

<body>

<script>

window.onerror = function(errMsg, url, line, column, error) {

var result = !column ? '' : '\ncolumn: ' + column;

result += !error;

document.write("Error= " + errMsg + "\nurl= " + url + "\nline= " + line + result);

var suppressErrorAlert = true;

return suppressErrorAlert;

};

setTimeout(function() {

eval("{");

}, 500)

</script>

</body>

</html>

If this helps then plzzzzz mark me brainliest.

Similar questions