JavaScript Console Methods

About This Index
This page is the JavaScript Console Methods index for the tutorial track. Each row names a console method and what that call prints or measures.
Learn what the console is on /js/console. Use this page when you need a specific call such as console.log(), console.table(), or console.time().
Start with log(), warn(), and error(). Then look up assert(), table(), group(), and time().
How to Call a Console Method
Every method in this index is called on console:
const rows = [
{ name: "Ada", score: 80 },
{ name: "Lin", score: 91 }
];
console.log(rows[0].name); // "Ada"
console.warn("Retrying");
console.table(rows);
console.time("load");
console.timeEnd("load"); JavaScript Console Methods Table
All console methods in this JavaScript tutorial series (14 methods).
Logging
4 methodsPrint a value, a note, a warning, or an error while you learn a JavaScript program.
| Method | Description | Tutorial |
|---|---|---|
console.log() | Prints a message or value. The usual first call in a JavaScript tutorial. | Open |
console.info() | Prints an informational message. In many browsers it looks like log() with an info icon. | Open |
console.warn() | Prints a warning. DevTools usually shows it in yellow so it stands out from normal logs. | Open |
console.error() | Prints an error message, often in red, with a stack trace when you pass an Error. | Open |
Checks and traces
4 methodsConfirm a condition, reset the panel, count calls, and see the call stack.
| Method | Description | Tutorial |
|---|---|---|
console.assert() | Prints a message only when the condition is false. A true condition stays quiet. | Open |
console.clear() | Clears the visible console messages so the next run starts on a clean panel. | Open |
console.count() | Counts how many times a label has been logged. Pair it with countReset() to start over. | Open |
console.trace() | Prints a stack trace from the line where you called it, so you can see who called the function. | Open |
Groups and tables
4 methodsNest related log lines, or print a list of records as a table.
| Method | Description | Tutorial |
|---|---|---|
console.group() | Opens an expanded group so the next log lines nest under one heading. | Open |
console.groupCollapsed() | Opens a collapsed group. In DevTools you expand it when you want the details. | Open |
console.groupEnd() | Closes the group most recently opened with group() or groupCollapsed(). | Open |
console.table() | Prints an array or an array of objects as a table with columns. | Open |
Timers
2 methodsMeasure how long a block of JavaScript takes to run.
| Method | Description | Tutorial |
|---|---|---|
console.time() | Starts a named timer. Call timeEnd() with the same label to print the elapsed time. | Open |
console.timeEnd() | Stops the timer from time() and prints how many milliseconds passed. | Open |
Frequently Asked Questions
Start with the Console lesson
See log(), warn(), and count() print real lines, then come back to this index.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
10 people found this page helpful
