Console.log()


#1

please can anybody give me some brief details regarding console.log()


#2

console is a javascript object that is used as a debugging tool. It has several methods, one of which is log(). MDN page with likely more details that you were expecting.

console.log() allows you to output information from your program to your browser's console. Here in these exercises, the space to the right is the console.

Put the information that you want to output inside the (). Here are some examples:

console.log("a text string");
console.log( 2 + 2 );

myName = "AlbionsRefuge";
console.log(myName);

Logging information is a good debugging tool. You can temporarily add console.log() statements that output messages and variable values that will help you see what is going on in your program.

console.log("in the loop now, variables x, y, and z are currently:  ", x, y, z);
console.log("just exited the loop");

Why using "console.log"?