There are certain situations where you want to generate output of your program as per your requirement. Sometime, you might want to see the value of variable, or write a message to browser console to help you debug an issue in your running JavaScript code, and so on.