Many webdevelopers still debug with console.log
. But there are more cool features you may not know about. To be clear: I would not recommend debugging with those, but sometimes...
Got an array of objects?
Check out console.table
.
Here you can see what it looks like with console.log
:
And here with console.table
:
It's a hell of a difference, isn't it?
Got an DOM-object?
console.dir
is your friend.
Here with console.log
:
And here with console.dir
Measure times?
Are you tired of subtracting timestamps? Just use console.time
& console.timeEnd
.
Upcoming?
What do you want to see next?
- How to Pi-Hole
- PWA #3
- something different
Let me know in the comments below.
With that in mind, happy coding.
(() => {
const colors = [
'001f3f', '0074d9', '7fdbff', '39cccc',
'3d9970', '2ecc40', '01ff70', 'ffdc00',
'ff851b', 'ff4136', '85144b', 'f012be',
];
const contents = ['%cI', '%c❤', '%cweb', '%cdev'];
const options = Array.from(
new Array(contents.length),
() => `
color:#${colors[Math.floor(Math.random() * colors.length)]};
font-size:64px;
`
);
console.log.apply(console, [contents.join('')].concat(options));
})();
Hello, your post was nominated for an upvote by a fellow within the Sndbox incubator. Thanks for sharing your console tricks @drookyn. Steem on :D
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Very nice, thanks :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Nice post @drookyn,
didn't know about these really cool!
Looking forward to the pi-hole tutorial :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Vielleicht sollte ich meinen Javascript Kurs bei Udemy endlich mal weiter machen ... :D
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Auf Udemy lernt man etwas? :D
Schreib mir einfach mal auf, wie du die ein gelungenes JavaScript Tutorial vorstellst & ich mach ne Serie draus. Auf meinem Plan steht eh schon ES6 :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Ja doch, schon. Kommt halt auf den Kurs an würde ich sagen. Nur mein Verständnis für JS is recht beschränkt. Ich als Designer habs einfach mehr mit Bildern und nicht so mit "logik" wenn du verstehst was ich meine ;-)
Daher fällt mir der Kurs für CSS3 & HTML5 irgendwie leichter. Damit kann ich auch so an sich viel mehr anfangen in der Praxis.
Mach lieber Frontend Kurse, da hab ich mehr von ;-)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Alles klar, mach ich 👍
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit