The Console panel is a text terminal that allows developers to interact with JavaScript.
The ESC key opens and collapses the Console panel. Basically the Console panel is a JavaScript interpreter that allows you to run JavaScript.

 

Basic Commands

Try the following commands:

4 + 3 
> 7
12 / 2
> 6
this
> Window { . . . . . . } 
window
> Window { . . . . . . } 
document
> #document
document.
clear()
>
Design Mode

document.designMode = “on”

Explore Objects

dir(App);
dir(window);

Get all elements of the same type
$('img');

Get Elements

> document.getElementById("intro")
OR
> $("#intro")

 

Console Log

This command can replace the alert(” “) Javascript command debuggers use to test the code.

> console.log("Started!")
< Started! 
> if (1 + 1 == 2) { console.log("It works!") }
< It works!

Assertion
> console.assert(1 + 1 == 3)
< Assertion failed!

 

Timing of Code Execution

The function console.time() can be used to start a timer in code, and the console.timeEnd() corresponds to the console.time() command (i.e. start and end).

> funtion MyLogTest(MyVar) {
 console.time("Loop");
 for(;;) {
 MyVar++;
 console.log("The value of MyVar is " + MyVar + ".");
 if (MyVar == 8) { break; }
 }
 console.timeEnd("Loop")
}
> MyLogTest()
< Loop: 0.782ms

Note: When typing in the Console, the shortcut key to skip down to the next line without executing a command is Shift + Enter

For more commands and utilizations of the Console panel, check the following link:
https://developers.google.com/chrome-developer-tools/docs/console-api