CKTIS / JavaScript
console.error — error-level messages
console.error logs an error-level message. Logging at that level does not itself throw an exception, but formatting can.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
console.error(...data)console.error(...data) is a Console API method, defined outside ECMAScript. It accepts any number of values, returns undefined on normal completion, and prints nothing when called without arguments.
It sends data to the logging mechanism at level error, rather than the log level used by console.log. The first argument can contain formatting specifiers: %s represents a string and %d an integer.
Logging at level error is not the same as using throw. However, formatting can throw an exception, for example if converting a value supplied for %d calls a coercion method that throws. Message presentation is implementation-defined; red coloring and a stack trace are not guaranteed.
Examples
console.error("Invalid quantity: %d", -2);
console.log("Execution continues");Result
Invalid quantity: -2 Execution continues
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.