DEV Community

Cover image for ๐Ÿ’”๐Ÿ’”๐Ÿ’” Bye-Bye Plain Old `console.log` โ€“ Letโ€™s Level Up Together! ๐Ÿ’ป
Kudzai Murimi
Kudzai Murimi

Posted on

๐Ÿ’”๐Ÿ’”๐Ÿ’” Bye-Bye Plain Old `console.log` โ€“ Letโ€™s Level Up Together! ๐Ÿ’ป

Hey there, friends! ๐Ÿ‘‹ How are you doing today? Whether youโ€™re diving into code for work, a personal project, or just exploring, I hope things are going smoothly.

Letโ€™s take a moment to talk about debugging. If youโ€™re like me, youโ€™ve leaned on trusty olโ€™ console.log more times than you can count. But guess what? Thereโ€™s a whole world beyond it that can make your debugging life way easier and even a little more fun. ๐ŸŽ‰

Today, I want to share some gems from the console family: console.table, console.info, console.warn, and console.error. Ready to upgrade your game? Letโ€™s go! ๐Ÿš€

1. console.table: Turn Your Data into a Masterpiece

Have you ever squinted at a jumble of arrays or objects in your console? Say goodbye to the mess!

Example:

const developers = [
  { name: "Riley", skill: "React", level: "Intermediate" },
  { name: "Taylor", skill: "Vue", level: "Advanced" },
  { name: "Jordan", skill: "Angular", level: "Beginner" },
];
console.table(developers);
Enter fullscreen mode Exit fullscreen mode

Output:

Your data is displayed in a neat, tabular format thatโ€™s easy on the eyes. Rows and columns, just like magic!

๐Ÿ›  Perfect for:

  • API responses
  • Comparing structured data
  • Debugging arrays of objects

2. console.info: Share the Good News

Need to sprinkle some info into your logs? console.info is like your gentle friend who gives you just the right updates.

Example:

console.info("๐ŸŒŸ Your server is running on port 8000!");
Enter fullscreen mode Exit fullscreen mode

Output:

This shows up with a friendly โ€œiโ€ icon in your console, making it stand out from the noise of regular logs.

Perfect for:

  • System updates
  • Contextual messages during testing
  • Anything you want to highlight without overwhelming

3. console.warn: Throw a Yellow Flag

Warnings are like little nudges that something isnโ€™t quite right. console.warn highlights them perfectly with a bold yellow badge.

Example:

console.warn("โš ๏ธ Youโ€™re running low on memory!");
Enter fullscreen mode Exit fullscreen mode

Output:

Bright yellow text catches your attention instantly, no way to miss it!

Perfect for:

  • Highlighting potential issues
  • Alerting about deprecated features
  • Giving users a heads-up

4. console.error: Roll Out the Red Carpet (for Errors)

Errors deserve to be loud and clear. console.error ensures that they stand out with a big, bold red badge.

Example:

console.error("โŒ Something went wrong: Unable to connect to the database!");
Enter fullscreen mode Exit fullscreen mode

Output:

Hard to miss, this one screams โ€œFix me!โ€

๐Ÿ›  Perfect for:

  • Debugging crashes
  • Flagging critical issues
  • Logging runtime errors

For more info, checkout: https://www.linkedin.com/posts/asifali1010_consolelog-ugcPost-7286622968460333056-ZGMg?utm_source=share&utm_medium=member_desktop

Have you used any of these before? Or maybe youโ€™ve got a cool debugging tip to share? Letโ€™s chat in the comments! Iโ€™d love to hear how you level up your console game or if you have any questions about these features.

Happy coding, and may your debugging always be clean and efficient!

Top comments (4)

Collapse
 
ranjith_02_90783826f1bc57 profile image
Ranjith 02

these all are old method

Collapse
 
respect17 profile image
Kudzai Murimi • Edited

Thanks @ranjith_02_90783826f1bc57 for your support!

Yes they are old methods but here we want others to know how easy and better they can debug

while console.log is a reliable go-to, advanced debugging methods bring structure, clarity, and professionalism to your workflow. They help you debug faster, collaborate better, and manage complex applications more effectively.

so someone may find this helpful.

some old methods can help someone new to industry up until he/gets to the latest ways of debugging

Collapse
 
shricodev profile image
Shrijal Acharya
Collapse
 
agunechemba profile image
Agunechemba Ekene

lots of people are used to console.log alone. I wrote a similar blog sometime last week: Read here