console.log()
Writes value(s) to the console.
Syntax
console.log(value1, value2, ...)
Description
Writes the values inside the parentheses to the output; if you provide multiple separated by commas, it puts spaces between them. It's the main tool for debugging and showing results.
Parameters
| value | One or more values to print. |
Returns
Returns nothing (undefined); writes to the console.
Example
Loading editor…
Expected output
Hello World 3
When to use?
Do not show results, monitor variable values, debugging.
Common mistakes
- ⚠️ In the browser, console.log output appears in the developer console (F12), not on the page.