Jamie's Console Log Blog!

Jamie's Console Log Blog

The Console Log was one of my favorite tools to use when I was learning the basics in HTML. It allows you to write, or log information to the console. This information can be viewed in Developer tools, by clicking the F12 key and then choosing the Console tab.

Sample Code:


                var vegetarian = prompt ("Are you a vegetarian (y/n)?");
                if(vegetarian == "y"){
                  console.log("I recommend the pasta salad.");
                } else{
                  console.log("I recommend the prime rib.");
                }
            


The Console Log is a great way to see what is happening with your program. This helps with troubleshooting. You can refresh your page and look in the Console Log to see what result a formula returned. You can also check to see what a user has input when prompted to answer a question.

I especially found the Console Log useful during the early stages of writing code, when there isn't much that could go wrong and I just wanted to see that something was actually happening when my code was run. The Debugger tool can be used instead of Console Log later in the process when you are more comfortable with your coding skills and have written more complex code.