Javascript console.trace() Method

Introduction

Show the trace of how the code ended up here:

Press F12 on your keyboard to view the result in the console view.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Start Trace</button>
<script>

function myFunction() {/*from w  w  w .j av  a  2  s .  c om*/
  myOtherFunction();
}
function myOtherFunction() {
  console.trace();
}

</script>

</body>
</html>

The console.trace() method displays a trace that show how the code ended up at a certain point.

console.trace();



PreviousNext

Related