--- title: Window.console slug: Web/API/Window/console tags: - API - Consola - Referencia - Só-de-leitura - Window - console translation_of: Web/API/Window/console ---
{{ APIRef }}
A propriedade só-de-leitura Window.console
devolve uma referência para o objeto {{domxref("Console")}}, que fornece métodos para registar informação na console do navegador. Estes métodos são destinados apenas para fins de depuração e não deverão ser invocados para apresentar informação aos utilizadores finais.
var consoleObj = window.console;
The first example logs text to the console.
console.log("An error occurred while loading the content");
The next example logs an object to the console, with the object's fields expandable using disclosure widgets:
console.dir(someObject);
See {{SectionOnPage("/en-US/docs/Web/API/Console", "Usage")}} for more thorough examples.
Especificação | Estado | Comentário |
---|---|---|
{{SpecName('Console API')}} | {{Spec2('Console API')}} | Initial definition. |
Currently there are many implementation differences among browsers, but work is being done to bring them together and make them more consistent with one another.