diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/it/web/javascript/reference/global_objects/null | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/it/web/javascript/reference/global_objects/null')
-rw-r--r-- | files/it/web/javascript/reference/global_objects/null/index.html | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/files/it/web/javascript/reference/global_objects/null/index.html b/files/it/web/javascript/reference/global_objects/null/index.html new file mode 100644 index 0000000000..80ee3de685 --- /dev/null +++ b/files/it/web/javascript/reference/global_objects/null/index.html @@ -0,0 +1,89 @@ +--- +title: 'null' +slug: Web/JavaScript/Reference/Global_Objects/null +translation_of: Web/JavaScript/Reference/Global_Objects/null +--- +<div>{{jsSidebar("Objects")}}</div> + +<p>Il valore <code>null</code> rappresenta l'assenza intenzionale di qualsiasi valore dell'oggetto. È una delle {{Glossary("Primitive", "primitive values")}} di JavaScript.</p> + +<div>{{EmbedInteractiveExample("pages/js/globalprops-null.html")}}</div> + + + +<h2 id="Sintassi">Sintassi</h2> + +<pre class="syntaxbox">null</pre> + +<h2 id="Descrizione">Descrizione</h2> + +<p>Il valore <code>null</code> è scritto con un letterale: <code>null</code>. <code>null</code> non è un identificatore per una proprietà dell'oggetto globale, come {{jsxref("Global_Objects/undefined","undefined")}} può essere. Invece, <code>null</code> esprime una mancanza di identificazione, indicando che una variabile punta a nessun oggetto. Nelle API, <code>null</code> viene spesso recuperato in un punto in cui è possibile prevedere un oggetto ma nessun oggetto è rilevante.</p> + +<pre class="brush: js">// foo non esiste Non è definito e non è mai stato inizializzato: +foo; +"ReferenceError: foo is not defined" + +// foo è noto per esistere ora ma non ha alcun tipo o valore: +var foo = null; +foo; +"null" +</pre> + +<h3 id="Differenze_tra_null_e_undefined">Differenze tra <code>null</code> e <code>undefined</code></h3> + +<p>Durante il controllo per <code>null</code> o <code>undefined</code>, attenti alle <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">differenze tra gli operatori equality (==) e identity (===)</a>, come il primo esegue la conversione del tipo.</p> + +<pre class="brush: js">typeof null // "object" (non "null" per motivi legacy) +typeof undefined // "undefined" +null === undefined // false +null == undefined // true +null === null // true +null == null // true +!null // true +isNaN(1 + null) // false +isNaN(1 + undefined) // true</pre> + +<h2 id="Specifiche">Specifiche</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specifica</th> + <th scope="col">Stato</th> + <th scope="col">Commento</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>Initial definition.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-4.3.11', 'null value')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-null-value', 'null value')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-null-value', 'null value')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilità_con_i_browser">Compatibilità con i browser</h2> + + + +<p>{{Compat("javascript.builtins.null")}}</p> + +<h2 id="Vedi_anche">Vedi anche</h2> + +<ul> + <li>{{jsxref("undefined")}}</li> + <li>{{jsxref("NaN")}}</li> +</ul> |