Issue #202 (console.clear(), Git/CLI, Productivity, Uncats)06/01/17
I have no idea why I've never thought of doing this before, but I saw this in a JS Bin tweeted by Remy Sharp (who is the creator of JS Bin). In that particular demo he's demonstrating how to set a default value (which I believe is an ES6 feature, if I'm not mistaken?):
console.clear();
const obj = {
a: 1
};
const { b = 20, a = 10 } = obj;
console.log(a, b);
|
View on JS BIn
I use JS Bin all the time, and I often log stuff to the console in JS Bin. I also usually allow JS Bin to auto-run, so it's constantly running the code each time I make a change, like live reload for a code editor. One of the annoying things about this is that the console is continually updated, so it gets messy with repeated logs.
Well, what a simple solution: Add
console.clear() to the top of your script so the console gets cleared every time the script runs. I know about
console.clear() for use in the browser's console, but I just never thought of putting it at the top of my scripts in JS Bin.
Now on to this week's tools!