This project is maintained by saeidzebardast
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.
The Console API provides web applications with methods for writing information to the console, creating JavaScript profiles, and initiating a debugging session.
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.".
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');Writes a message to the console, including a hyperlink to the line where it was called.
console.debug('I am debug message');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!');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!');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!');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 faildClears the console.
console.clear();Prints an interactive listing of all properties of the object.
console.dir(document.body);Prints the XML source tree of an HTML or XML element.
console.dirxml(document.body);Prints an interactive stack trace of JavaScript execution at the point where it is called.
console.trace();The stack trace details the functions on the stack, as well as the values that were passed as arguments to each function.
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:');Like 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 console.group() or console.groupCollapsed()
console.groupEnd();Creates a new timer under the given name. Call console.timeEnd() with the same name to stop the timer and print the time elapsed.
console.time('timer');Stops a timer created by a call to console.time(name) and writes the time elapsed.
console.timeEnd('timer');Creates a time stamp.
console.timeStamp('timeStamp');Turns on the JavaScript profiler.
console.profile('my-profile');Turns off the JavaScript profiler and prints its report.
console.profileEnd('my-profile');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"]);