aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/web/api/window/console/index.html
blob: 80abc2170c4fa353fdd71565679ffbb0e12519f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: Window.console
slug: Web/API/Window/console
tags:
  - API
  - Consola
  - Referencia
  - Só-de-leitura
  - Window
  - console
translation_of: Web/API/Window/console
---
<p>{{ APIRef }}</p>

<p>A propriedade só-de-leitura <em><strong><code>Window.console</code></strong></em> devolve uma referência para o objeto {{domxref("Console")}}, que fornece métodos para registar informação na <em>console </em>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.</p>

<h2 id="Syntax" name="Syntax">Sintaxe</h2>

<pre class="syntaxbox"><em>var consoleObj</em> = <em>window</em>.console;
</pre>

<h2 id="Example" name="Example">Exemplos</h2>

<h3 id="Registar_para_console">Registar para console</h3>

<p>The first example logs text to the console.</p>

<pre class="brush: js">console.log("An error occurred while loading the content");
</pre>

<p>The next example logs an object to the console, with the object's fields expandable using disclosure widgets:</p>

<pre class="brush: js">console.dir(someObject);</pre>

<p>See {{SectionOnPage("/en-US/docs/Web/API/Console", "Usage")}} for more thorough examples.</p>

<h2 id="Especificações">Especificações</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Especificação</th>
   <th scope="col">Estado</th>
   <th scope="col">Comentário</th>
  </tr>
  <tr>
   <td>{{SpecName('Console API')}}</td>
   <td>{{Spec2('Console API')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<div class="note">
<p>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.</p>
</div>