As a web developer, it’s necessary that you be familiar with console.log(). It is the most straightforward approach to troubleshoot anything by logging the value of variables in developer tools. But the console API is much more than that, it provides many other methods that can you help in debugging.
If you have only used console.log() and a couple of other methods for debugging,** I guarantee**that after reading this article you will learn new console methods that will take your JavaScript debugging to the next level.
List of all the console methods that are explained in this article:
This is the most common method for general-purpose logging. This function simply outputs any variables/strings to the console. You can list multiple variables/strings by using a comma between them.
I have illustrated a few examples below:
console.log('Simple console message')
/**** Output ****/
// Simple console message
const str1 = 'Hello'
const str2 = 'World'
console.log(str1, str2)
/**** Output ****/
// Hello World
#javascript #javascript-tips #debugging #programming #console