Let’s talk about “console.log”
In javascript, console.log is probably one of the most frequent methods that you use and see during the development process. It is because of the very useful and yet powerful tool to discover the errors and outsee the messages of the function or methods that we implied in the code. However, did you know that there is more than just “console.log” in Javascript? like console.dir, console.info, console. warn, console.error.. and etc. So let’s take a lot at some of the useful methods that we could use in our codes!
First is our best friend “console.log” According to MDN console.log() is a method that prints a message to the web console.
Simple magic, and simple to imply as the image shows above.
Second is called “console.dir”, console.dir() is very similar to console.log() that it display a message but also an interactive list of the properties of the specified JS object.
Here we see a lot of information about the property of an object. It shows the details of the properties and let the user discover more specified information.
Third, we have “console.count”, now console.count() is a useful method that can be used for logging the number of times it has been called with the given label.
Not only console.log() is useful but as we saw above examples, such as a console.dir(), console.count() and etc can be very handy for appropriate use in the codes.