Console

The console object provides access to the browser's debugging console (e.g. the Web console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided.

The console object can be accessed from any global object. Window on browsing scopes and WorkerGlobalScope as specific variants in workers via the property console. It's exposed as Window.console, and can be referenced as console.

console.log("Failed to open the specified link");

Methods:

console.assert()
Log a message and stack trace to console if the first argument is false.
console.assert("error" != false);
console.assert("error" == false);
console.clear()
clear the console
console.clear
console.count()
log the number of times this line has been called with the given label.
console.dir()
Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects.
console.error()
outputs an error message
console.error("error");
console.info()
informative logging of information
console.info("info");
console.log()
for general output of logging information
console.log("log");
console.table()
displays tabular data as a table.
console.table(console);
console.time()
starts a timer with a name specified as an input parameter. Up to 10,000 simultaneous timers can run on a given page.
console.time("P1");
console.timeLog()
logs the value of the specified timer to the console.
console.timeLog("P1");
console.timeEnd()
stops the specified timer and logs the elapsed time in milliseconds since it started.
console.timeEnd("P1");
console.warn()
outputs a warning message
console.warn("warn");

Proper code:

console.log("log");
console.info("info");
console.warn("warn");
console.error("error");
console.assert("error" != false);
console.assert("error" == false);
console.table(console);
                    
console.time('P1');
                    
console.time('forLoop');
for (let i = 0; i<5; i++) {
    console.log(233);
}
console.timeEnd('forLoop');
                    
console.time('whileLoop');
let i = 0;
while (i<5) {
    console.log(233);
    i++;
}
console.timeEnd('whileLoop');
                    
console.timeLog('P1');  
console.timeEnd('P1');
                    
console.dir(document.body);