Reputation: 28472
If I want to track a variable that updates very frequently, I can do console.log(myVar);
, which appends a line at the bottom of the console:
Is there a way to replace the value of the last line, instead of appending a new line at the bottom?
This would be super helpful, because then I could look at previous logs without having them get scrolled out of view at the top.
I've tried the following:
console.clear();
console.log(myObject);
console.log(myVar);
But this doesn't work because re-logging objects collapses them, plus it flickers too much in Chrome. I read the MDN documentation on the console, and even though it has lots of neat features, I couldn't figure out how to just rewrite a single line. I've seen it being done in terminals/command prompts, does the browser console have that capability?
Upvotes: 6
Views: 4788
Reputation: 2673
Google chrome has now in console ability to "Create live expression"
Upvotes: 8