Usually, when I want to record data in JavaScript, I opt for logging it to the console with
console.log("What I had for dinner yesterday");
However, while exploring a Karma/Jasmine unit testing video tutorial for AngularJS hosted by Vojta Jína, I came across a different logging method - using window.dump
.
I'm curious to know what advantages this type of logging offers compared to just using console.log
. I found information about dump
function on window
in this MDN article, but it seems like the logs appear directly in my terminal window where my tests run. Additionally, there is some guidance on how to dump
in the AngularJS documentation, but I'm not sure if it's the same technique demonstrated by Vojta Jina.
If anyone can shed light on the logging method used by Vojta and provide further resources or insights into proper logging practices in JavaScript, I would greatly appreciate it.