Console.error()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Non-standard: 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.

'Escreve' uma mensagem de erro no Web Console.

Nota: This feature is available in Web Workers.

Sintaxe

console.error(obj1 [, obj2, ..., objN]);
console.error(msg [, subst1, ..., substN]);
console.exception(obj1 [, obj2, ..., objN]);
console.exception(msg [, subst1, ..., substN]);

Nota: console.exception() é um alias para console.error(); as funcionalidades deles são identicas.

Parâmetros

obj1 ... objN

Uma lista de objetos Javascript para serem escritos. As representações String de cada um destes objetos é ligada junto na ordem listada e escrita.

msg

Uma String Javascript contendo zero ou mais Strings de substituição.

subst1 ... substN

Objetos JavaScript o qual substituirão as Strings no msg. Este parâmetro fornece controle adicional sobre o formato de output.

Veja Outputting text to the console na documentação de console para mais detalhes.

Especificações

Specification
Console
# error

Compatibilidade com navegadores

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
error() static method

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Ver também