DEV Community


Posted on

How Console.Log() changed everything for me!

In the very beginning of my journey learning JavaScript I often wondered what the significance of console.log() was, until .. I frequently ran into errors or couldn't access a nested value. My professor often says console.log everything! Now I understand why. Life before console log was very stressful and still is, quite frankly when learning programming but it alleviates so much of the stress and the guessing.

If you're a beginner like myself, and don't truly understand let's break this down. Console.log() is a tool used to print/log information to your console. It helps you see the output of your code, and information such as objects to help you see the path to nested objects. When you see that path in the console, it helps you map out your way of accessing that data in your code. When we write console.log what we write in the parenthesis will be displayed in the console.

I also want to clear a confusion I had when trying to understand console.log. It is not the same as return. Return is used for returning values from a function. console.log is used for debugging/informative purposes. Users see what's being returned in the UI. Your console.log(), however, is not rendered onto the webpage, it is a tool for developers that logs information in the console.

Console.log() is all about extracting the most relevant information when debugging/logging code. It will help you be more efficient and in return save you a ton of time and stress. Console.log() is your best friend, use it and use it often.

Discussion (0)