Answers for "how to get error stack trace in js"

0

how to get error stack trace in js

<!DOCTYPE HTML>
<meta charset="UTF-8">
<title>Stack Trace Example</title>
<body>
<script>
function trace() {
  try {
    throw new Error('myError');
  }
  catch(e) {
    alert(e.stack);
  }
}
function b() {
  trace();
}
function a() {
  b(3, 4, '\n\n', undefined, {});
}
a('first call, firstarg');
</script>
Posted by: Guest on May-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language