Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A modified version of <a href="http://ivan-ghandhi.livejournal.com/942493.html" rel="noreferrer">this snippet</a> may somewhat help:</p> <pre class="lang-js prettyprint-override"><code>function stacktrace() { function st2(f) { return !f ? [] : st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + f.arguments.join(',') + ')']); } return st2(arguments.callee.caller); } </code></pre> <p><br /></p> <p><strong>EDIT 2 (2017) :</strong></p> <p>In all modern browsers you can simply call: <code>console.trace();</code> <a href="https://developer.mozilla.org/en-US/docs/Web/API/Console/trace" rel="noreferrer">(MDN Reference)</a></p> <p><strong>EDIT 1 (2013):</strong></p> <p>A better (and simpler) solution as pointed out in the comments on the original question is to use the <code>stack</code> property of an <code>Error</code> object like so:</p> <pre class="lang-js prettyprint-override"><code>function stackTrace() { var err = new Error(); return err.stack; } </code></pre> <p>This will generate output like this:</p> <pre class="lang-none prettyprint-override"><code>DBX.Utils.stackTrace@http://localhost:49573/assets/js/scripts.js:44 DBX.Console.Debug@http://localhost:49573/assets/js/scripts.js:9 .success@http://localhost:49573/:462 x.Callbacks/c@http://localhost:49573/assets/js/jquery-1.10.2.min.js:4 x.Callbacks/p.fireWith@http://localhost:49573/assets/js/jquery-1.10.2.min.js:4 k@http://localhost:49573/assets/js/jquery-1.10.2.min.js:6 .send/r@http://localhost:49573/assets/js/jquery-1.10.2.min.js:6 </code></pre> <p>Giving the name of the calling function along with the URL, its calling function, and so on.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload