DEV Community

DwightColbyJack
DwightColbyJack

Posted on

Console.log(everything)

As a new developer, things like debugging can be tedious, confusing, and disheartening. Thinking and planning in a computer language calls for incremental building of the behavior you want and when conceptualizing that behavior it often helps to just "take a look under the hood." Thanks to console.logs you can see an element you want created, observe what kind of promise you get after a fetch call, and track the behavior of your functions.
The MDN definition for console.log states
"The Console method log() outputs a message to the web console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects."
When making a fetch call in a Javascript application I wanted to make, I plugged by returned promise in a "data" variable into a console.log and behold the console showed me the structure and content of the promise in the dev tools.
During a tutorial build out of a NextJS/ Advanced React webpage, we console.log the return of some functions to see their behavior in action. Console.log is one of the most important tools in my development practice.

Top comments (0)