--- title: 'null' slug: Web/JavaScript/Reference/Global_Objects/null translation_of: Web/JavaScript/Reference/Global_Objects/null --- <div> <div> <div>{{jsSidebar("Objects")}}</div> </div> </div> <h2 id="Resumo">Resumo</h2> <p>O valor <code>null</code> é um literal em JavaScript que representa um valor nulo ou "vazio" (p/ex: que aponta para um objeto inexistente). É um dos {{Glossary("Primitivo", "valores primitivos")}} do JavaScript.</p> <h2 id="Syntax" name="Syntax">Sintaxe</h2> <pre class="syntaxbox"><code>null </code></pre> <h2 id="Description" name="Description">Descrição</h2> <p>O valor <code>null</code> é um literal, e não uma propriedade do objeto global (como o <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined" title="/en-US/docs/JavaScript/Reference/Global_Objects/undefined"><code>undefined</code></a> pode ser). O desenhos das APIs, o null as vezes é devolvido no lugar de um objeto que era esperado. Quando fizer a checagem de um valor para <code>null</code> ou <code>undefined</code>, esteja ciente das <a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">diferenças entre o operador de igualdade (==) e o de igualdade estrita (===)</a> (em inglês). Uma conversão de tipos é realizada na operação de igualdade.</p> <pre class="brush: js">// foo não existe, não foi definido e jamais foi inicializado: > foo "ReferenceError: foo is not defined" // foo é conhecido e existe, mas não aponta para nenhum tipo ou valor: > var foo = null; foo "null" </pre> <h3 id="Diferenças_entre_null_e_undefined">Diferenças entre <code>null</code> e <code>undefined</code></h3> <pre class="brush: js">typeof null // object (bug no ECMAScript, deveria ser null - <a href="#">http://2ality.com/2013/10/typeof-null.html</a>) typeof undefined // undefined null === undefined // falso null == undefined // verdadeiro </pre> <h2 id="Especificações">Especificações</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Especificação</th> <th scope="col">Status</th> <th scope="col">Comentários</th> </tr> <tr> <td>ECMAScript 1st Edition.</td> <td>Standard</td> <td>Definição inicial</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> </tbody> </table> <h2 id="Browser_compatibility">Compatibilidade com navegadores</h2> <p>{{ CompatibilityTable() }}</p> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> </tr> </tbody> </table> </div> <div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Chrome for Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> </tr> </tbody> </table> </div> <h2 id="See_also" name="See_also">Veja também</h2> <ul> <li>{{jsxref("Global_Objects/undefined", "undefined")}}</li> <li>{{jsxref("Global_Objects/NaN", "NaN")}}</li> </ul>