From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- files/it/web/api/console/index.html | 294 ------------------------------ files/it/web/api/console/log/index.html | 88 --------- files/it/web/api/console/table/index.html | 143 --------------- 3 files changed, 525 deletions(-) delete mode 100644 files/it/web/api/console/index.html delete mode 100644 files/it/web/api/console/log/index.html delete mode 100644 files/it/web/api/console/table/index.html (limited to 'files/it/web/api/console') diff --git a/files/it/web/api/console/index.html b/files/it/web/api/console/index.html deleted file mode 100644 index 61521af0f3..0000000000 --- a/files/it/web/api/console/index.html +++ /dev/null @@ -1,294 +0,0 @@ ---- -title: Console -slug: Web/API/Console -tags: - - API - - Debugging - - Interface - - NeedsTranslation - - Reference - - TopicStub - - console - - web console -translation_of: Web/API/Console ---- -
{{APIRef("Console API")}}
- -

The Console object provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided.

- -

The Console object can be accessed from any global object. {{domxref("Window")}} on browsing scopes and {{domxref("WorkerGlobalScope")}} as specific variants in workers via the property console. It's exposed as {{domxref("Window.console")}}, and can be referenced as simply console. For example:

- -
console.log("Failed to open the specified link")
- -

This page documents the {{anch("Methods")}} available on the Console object and gives a few {{anch("Usage")}} examples.

- -

{{AvailableInWorkers}}

- -

Methods

- -
-
{{domxref("Console.assert()")}}
-
Log a message and stack trace to console if the first argument is false.
-
{{domxref("Console.clear()")}}
-
Clear the console.
-
{{domxref("Console.count()")}}
-
Log the number of times this line has been called with the given label.
-
{{domxref("Console.countReset()")}}
-
Resets the value of the counter with the given label.
-
{{domxref("Console.debug()")}}
-
Outputs a message to the console with the log level "debug". -
Note: Starting with Chromium 58 this method only appears in Chromium browser consoles when level "Verbose" is selected.
-
-
{{domxref("Console.dir()")}}
-
Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects.
-
{{domxref("Console.dirxml()")}}
-
-

Displays an XML/HTML Element representation of the specified object if possible or the JavaScript Object view if it is not possible.

-
-
{{domxref("Console.error()")}}
-
Outputs an error message. You may use string substitution and additional arguments with this method.
-
{{domxref("Console.exception()")}} {{Non-standard_inline}} {{deprecated_inline}}
-
An alias for error().
-
{{domxref("Console.group()")}}
-
Creates a new inline group, indenting all following output by another level. To move back out a level, call groupEnd().
-
{{domxref("Console.groupCollapsed()")}}
-
Creates a new inline group, indenting all following output by another level. However, unlike group() this starts with the inline group collapsed requiring the use of a disclosure button to expand it. To move back out a level, call groupEnd().
-
{{domxref("Console.groupEnd()")}}
-
Exits the current inline group.
-
{{domxref("Console.info()")}}
-
Informative logging of information. You may use string substitution and additional arguments with this method.
-
{{domxref("Console.log()")}}
-
For general output of logging information. You may use string substitution and additional arguments with this method.
-
{{domxref("Console.profile()")}} {{Non-standard_inline}}
-
Starts the browser's built-in profiler (for example, the Firefox performance tool). You can specify an optional name for the profile.
-
{{domxref("Console.profileEnd()")}} {{Non-standard_inline}}
-
Stops the profiler. You can see the resulting profile in the browser's performance tool (for example, the Firefox performance tool).
-
{{domxref("Console.table()")}}
-
Displays tabular data as a table.
-
{{domxref("Console.time()")}}
-
Starts a timer with a name specified as an input parameter. Up to 10,000 simultaneous timers can run on a given page.
-
{{domxref("Console.timeEnd()")}}
-
Stops the specified timer and logs the elapsed time in seconds since it started.
-
{{domxref("Console.timeLog()")}}
-
Logs the value of the specified timer to the console.
-
{{domxref("Console.timeStamp()")}} {{Non-standard_inline}}
-
Adds a marker to the browser's Timeline or Waterfall tool.
-
{{domxref("Console.trace()")}}
-
Outputs a stack trace.
-
{{domxref("Console.warn()")}}
-
Outputs a warning message. You may use string substitution and additional arguments with this method.
-
- -

Usage

- -

Outputting text to the console

- -

The most frequently-used feature of the console is logging of text and other data. There are four categories of output you can generate, using the {{domxref("console.log()")}}, {{domxref("console.info()")}}, {{domxref("console.warn()")}}, and {{domxref("console.error()")}} methods respectively. Each of these results in output styled differently in the log, and you can use the filtering controls provided by your browser to only view the kinds of output that interest you.

- -

There are two ways to use each of the output methods; you can simply pass in a list of objects whose string representations get concatenated into one string, then output to the console, or you can pass in a string containing zero or more substitution strings followed by a list of objects to replace them.

- -

Outputting a single object

- -

The simplest way to use the logging methods is to output a single object:

- -
var someObject = { str: "Some text", id: 5 };
-console.log(someObject);
-
- -

The output looks something like this:

- -
[09:27:13.475] ({str:"Some text", id:5})
- -

Outputting multiple objects

- -

You can also output multiple objects by simply listing them when calling the logging method, like this:

- -
var car = "Dodge Charger";
-var someObject = { str: "Some text", id: 5 };
-console.info("My first car was a", car, ". The object is:", someObject);
- -

This output will look like this:

- -
[09:28:22.711] My first car was a Dodge Charger . The object is: ({str:"Some text", id:5})
-
- -

Using string substitutions

- -

Gecko 9.0 {{geckoRelease("9.0")}} introduced support for string substitutions. When passing a string to one of the console object's methods that accepts a string, you may use these substitution strings:

- - - - - - - - - - - - - - - - - - - - - - - - -
Substitution stringDescription
%o or %OOutputs a JavaScript object. Clicking the object name opens more information about it in the inspector.
%d or %iOutputs an integer. Number formatting is supported, for example  console.log("Foo %.2d", 1.1) will output the number as two significant figures with a leading 0: Foo 01
%sOutputs a string.
%fOutputs a floating-point value. Formatting is supported, for example  console.log("Foo %.2f", 1.1) will output the number to 2 decimal places: Foo 1.10
- -
-

Note: Precision formatting doesn't work in Chrome

-
- -

Each of these pulls the next argument after the format string off the parameter list. For example:

- -
for (var i=0; i<5; i++) {
-  console.log("Hello, %s. You've called me %d times.", "Bob", i+1);
-}
-
- -

The output looks like this:

- -
[13:14:13.481] Hello, Bob. You've called me 1 times.
-[13:14:13.483] Hello, Bob. You've called me 2 times.
-[13:14:13.485] Hello, Bob. You've called me 3 times.
-[13:14:13.487] Hello, Bob. You've called me 4 times.
-[13:14:13.488] Hello, Bob. You've called me 5 times.
-
- -

Styling console output

- -

You can use the %c directive to apply a CSS style to console output:

- -
console.log("This is %cMy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px");
- -
The text before the directive will not be affected, but the text after the directive will be styled using the CSS declarations in the parameter.
- -
 
- -
- -
 
- -
-

Note: Quite a few CSS properties are supported by this styling; you should experiment and see which ones prove useful.

-
- -
 
- -
{{h3_gecko_minversion("Using groups in the console", "9.0")}}
- -

You can use nested groups to help organize your output by visually combining related material. To create a new nested block, call console.group(). The console.groupCollapsed() method is similar but creates the new block collapsed, requiring the use of a disclosure button to open it for reading.

- -
Note: Collapsed groups are not supported yet in Gecko; the groupCollapsed() method is the same as group() at this time.
- -

To exit the current group, simply call console.groupEnd(). For example, given this code:

- -
console.log("This is the outer level");
-console.group();
-console.log("Level 2");
-console.group();
-console.log("Level 3");
-console.warn("More of level 3");
-console.groupEnd();
-console.log("Back to level 2");
-console.groupEnd();
-console.debug("Back to the outer level");
-
- -

The output looks like this:

- -

nesting.png

- -
{{h3_gecko_minversion("Timers", "10.0")}}
- -

In order to calculate the duration of a specific operation, Gecko 10 introduced the support of timers in the console object. To start a timer, call the console.time() method, giving it a name as the only parameter. To stop the timer, and to get the elapsed time in milliseconds, just call the console.timeEnd() method, again passing the timer's name as the parameter. Up to 10,000 timers can run simultaneously on a given page.

- -

For example, given this code:

- -
console.time("answer time");
-alert("Click to continue");
-console.timeLog("answer time");
-alert("Do a bunch of other stuff...");
-console.timeEnd("answer time");
-
- -

Will log the time needed by the user to dismiss the alert box, log the time to the console, wait for the user to dismiss the second alert, and then log the ending time to the console:

- -

timerresult.png

- -

Notice that the timer's name is displayed both when the timer is started and when it's stopped.

- -
Note: It's important to note that if you're using this to log the timing for network traffic, the timer will report the total time for the transaction, while the time listed in the network panel is just the amount of time required for the header. If you have response body logging enabled, the time listed for the response header and body combined should match what you see in the console output.
- -

Stack traces

- -

The console object also supports outputting a stack trace; this will show you the call path taken to reach the point at which you call {{domxref("console.trace()")}}. Given code like this:

- -
function foo() {
-  function bar() {
-    console.trace();
-  }
-  bar();
-}
-
-foo();
-
- -

The output in the console looks something like this:

- -

- -

Specifications

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('Console API')}}{{Spec2('Console API')}}Initial definition.
- -

Browser compatibility

- - - -

{{Compat("api.Console")}}

- -

Notes

- - - -

See also

- - - -

Other implementations

- - diff --git a/files/it/web/api/console/log/index.html b/files/it/web/api/console/log/index.html deleted file mode 100644 index 4229185824..0000000000 --- a/files/it/web/api/console/log/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: console.log() -slug: Web/API/Console/log -translation_of: Web/API/Console/log ---- -
{{APIRef("Console API")}}
- -

Il metodo  log() di {{domxref("Console")}} stampa un messaggio sulla web console. Il messaggio può essere una semplice stringa (opzionalmente, anche con valori sostituibili), o può essere uno qualsiasi o più oggetti JavaScript.

- -

{{AvailableInWorkers}}

- -

Sintassi

- -
console.log(obj1 [, obj2, ..., objN]);
-console.log(msg [, subst1, ..., substN]);
-
- -

Parametri

- -
-
obj1 ... objN
-
Una lista di oggetti JavaScript da stampare. La rappresentazione sotto forma di stringa di ciascuno di questi oggetti sarà messa in coda nell'ordine presentato e stampata. Perfavore fai attenzione che se tu stampi degli oggetti nelle ultime versioni si Chrome e Firefox quello che otterrai sarà un riferimento all'oggetto, che non necessariamente è il 'valore' dell'oggetto nel momento della chiamata di console.log(), ma è il valore dell'oggetto al momento in cui tu apri la console.
-
msg
-
Una stringa JavaScript contenente zero o più stringhe da sostituire.
-
subst1 ... substN
-
Oggetti JavaScript con i quali verranno sostituite le stringhe da sostituire in msg. Questo ti offre controlli aggiuntivi sul formato dell'output
-
- -

Vedi Stampare del testo sulla Console nella documentazione di {{domxref("console")}} per maggiori dettagli.

- -

Differenza tra log() e dir()

- -

Ti potresti esser chiesto qual è la differenza tra {{domxref("console.dir()")}} e console.log().

- -

Un'altra utile differenza esiste in Chrome quando invii elementi DOM alla console.

- -

- -

Nota bene:

- - - -

Specificamente, console.log offre un trattamento speciale agli elementi del DOM, mentre console.dir non lo fa. Ė spesso utile quando si prova a vedere la rappresentazione completa degli oggetti JS del DOM.

- -

Ulteriori informazioni si possono trovare sulle Chrome Console API reference su questa e altre funzioni.

- -

Registrare (loggare) gli oggetti

- -

Non usare console.log(obj), usa console.log(JSON.parse(JSON.stringify(obj))).

- -

In questo modo sarai sicuro di visulizzare il valore di obj al momento in cui lo stai registrando (loggando). Altrimenti, svariati browser offrono una vista live che aggiorna costantemente i valori non appena cambiano. Potrebbe non essere quel che cerchi.

- -

Specifiche

- - - - - - - - - - - - - - - - -
SpecificheStatoCommento
{{SpecName("Console API", "#log", "console.log()")}}{{Spec2("Console API")}}Definizione iniziale
- -

Compatibilità con i browser

- - - -

{{Compat("api.Console.log")}}

- -

Vedi anche

- - diff --git a/files/it/web/api/console/table/index.html b/files/it/web/api/console/table/index.html deleted file mode 100644 index d2ae5bbce2..0000000000 --- a/files/it/web/api/console/table/index.html +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: Console.table() -slug: Web/API/Console/table -translation_of: Web/API/Console/table ---- -
 {{APIRef("Console API")}}
- -

Visualizza dati tabulari come una tabella.

- -

Questa funzione richiede un argomento obbligatorio data, che deve essere un array di oggetti, ed un parametro opzionale columns.

- -

La funzione visualizza data come una tabella ed ogni elemento dell'array (o ogni sua proprietà numerabile se data è un oggetto) sarà una riga della tabella.

- -

La prima colonna della tabella rappresenta l'etichetta (index). Se data è un array allora il valore sarà il suo indice nell'array. Se, invece, data è un oggetto, il suo valore sarà il nome della proprietà. Nota che (in Firefox) console.table limita a 1000 la visualizzazione delle righe (la prima riga contiene i nomi delle etichette).

- -

{{AvailableInWorkers}}

- -

Collezioni di tipi di primitive

- -

L'argomento data può essere un array o un oggetto.

- -
// array di stringhe
-
-console.table(["apples", "oranges", "bananas"]);
- -

- -
// un oggetto le cui proprietà sono stringhe
-
-function Person(firstName, lastName) {
-  this.firstName = firstName;
-  this.lastName = lastName;
-}
-
-var me = new Person("John", "Smith");
-
-console.table(me);
- -

- -

Collezioni di tipi composti

- -

Se l'elemento nell'array o le proprietà nell'oggetto sono a loro volta array o oggetti, allora i loro elementi o proprietà sono enumerati nella riga, uno per colonna:

- -
// un array di arrays
-
-var people = [["John", "Smith"], ["Jane", "Doe"], ["Emily", "Jones"]]
-console.table(people);
- -

Table displaying array of arrays

- -
// un array di oggetti
-
-function Person(firstName, lastName) {
-  this.firstName = firstName;
-  this.lastName = lastName;
-}
-
-var john = new Person("John", "Smith");
-var jane = new Person("Jane", "Doe");
-var emily = new Person("Emily", "Jones");
-
-console.table([john, jane, emily]);
- -

Nota che se l'array contiene oggetti, allora le colonne sono etichettate con il nome della proprietà.

- -

Table displaying array of objects

- -
// un oggetto le cui proprietà sono oggetti
-
-var family = {};
-
-family.mother = new Person("Jane", "Smith");
-family.father = new Person("John", "Smith");
-family.daughter = new Person("Emily", "Smith");
-
-console.table(family);
- -

Table displaying object of objects

- -

Restringimento delle colonne visualizzate

- -

Di default, console.table() visualizza la lista di elementi in ogni riga. Puoi usare il parametro opzionale columns per selezionare un sottoinsieme delle colonne da visualizzare:

- -
// un array di oggetti, visualizzando solo firstName
-
-function Person(firstName, lastName) {
-  this.firstName = firstName;
-  this.lastName = lastName;
-}
-
-var john = new Person("John", "Smith");
-var jane = new Person("Jane", "Doe");
-var emily = new Person("Emily", "Jones");
-
-console.table([john, jane, emily], ["firstName"]);
- -

Table displaying array of objects with filtered output

- -

Ordinamento delle colonne

- -

Puoi ordinare la tabella in base ad una particolare colonna cliccando sulla sua etichetta.

- -

Sintassi

- -
console.table(data [, columns]);
-
- -

Parametri

- -
-
data
-
Il dato da visualizzare. Deve essere un oggetto o un array.
-
columns
-
Un array contenente i nomi delle colonne da includere nell'output.
-
- -

Specifiche

- - - - - - - - - - - - - - - - -
SpecificheStatoCommenti
{{SpecName("Console API", "#table", "console.table()")}}{{Spec2("Console API")}}Initial definition
- -

Compatibilità dei browser

- -
- - -

{{Compat("api.Console.table")}}

-
-- cgit v1.2.3-54-g00ecf