All in one Console API
This repository contains some samples of using the Console API. All the essential methods of Console API are included with a sample in README.md.
What's Console API?
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.".
console.log(object[, object, ...])
Writes a message to the console. You may pass as many arguments as you'd like, and they will be joined together in a space-delimited line.
console.log('This is a sample log');
console.debug(object[, object, ...])
Writes a message to the console, including a hyperlink to the line where it was called.
console.debug('I am debug message');
console.info(object[, object, ...])
Writes a message to the console with the visual "info" icon and color coding and a hyperlink to the line where it was called.
console.info('I just want to share info!');
console.warn(object[, object, ...])
Writes a message to the console with the visual "warning" icon and color coding and a hyperlink to the line where it was called.
console.warn('Be quite! Big brother is watching you!');
console.error(object[, object, ...])
Writes a message to the console with the visual "error" icon and color coding and a hyperlink to the line where it was called.
console.error('Something goes wrong!');
console.assert(expression[, object, ...])
Tests that an expression is true. If not, it will write a message to the console and throw an exception.
console.assert((2 + 3) === 5); // Assertation true console.assert((2 * 1 * 0) === 3, 'It should be 0!'); // Assertation faild
Clears the console.
Prints an interactive listing of all properties of the object.
Prints the XML source tree of an HTML or XML element.
The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function.
console.group(object[, object, ...])
Writes a message to the console and opens a nested block to indent all future messages sent to the console. Call
console.groupEnd() to close the block.
console.group('Group log is started:');
console.groupCollapsed(object[, object, ...])
console.group(), but the block is initially collapsed.
console.groupCollapsed('Group log is started (collapsed):');
Closes the most recently opened block created by a call to
Creates a new timer under the given name. Call
console.timeEnd() with the same name to stop the timer and print the time elapsed.
Stops a timer created by a call to
console.time(name) and writes the time elapsed.
Creates a time stamp.
Writes the number of times that the line of code where
count was called was executed.
console.count('count this line!');
Allows to log provided data using tabular layout.
console.table(["apples", "oranges", "bananas"]);