aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/javascript/reference/global_objects/number/nan/index.html
blob: dd71aa97dfa83038046aa978729ea6635b6f8b48 (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
57
58
59
60
---
title: Number.NaN
slug: Web/JavaScript/Reference/Global_Objects/Number/NaN
tags:
  - JavaScript
  - Número
  - Propiedad
translation_of: Web/JavaScript/Reference/Global_Objects/Number/NaN
original_slug: Web/JavaScript/Referencia/Objetos_globales/Number/NaN
---
<div>{{JSRef}}</div>

<p>La propiedad <strong><code>Number.NaN</code></strong> representa Not-A-Number (No es numero). Equivalente de  {{jsxref("NaN")}}.</p>

<div>{{EmbedInteractiveExample("pages/js/number-nan.html")}}</div>

<p>No tienes que crear un objeto {{jsxref("Number")}} para acceder a esta propiedad estática (usa <code>Number.NaN</code>).</p>

<div>{{js_property_attributes(0, 0, 0)}}</div>

<h2 id="Ejemplos">Ejemplos</h2>

<h3 id="Chequea_si_los_valores_son_numericos">Chequea si los valores son numericos</h3>

<pre class="brush: js notranslate">function sanitise(x) {
  if (isNaN(x)) {
    return Number.NaN;
  }
  return x;
}</pre>

<h3 id="Testing_against_NaN">Testing against NaN</h3>

<p>See <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN#Testing_against_NaN">Testing against NaN</a> on the <code>NaN</code> page.</p>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Especificación</th>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-number.nan', 'Number.NaN')}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat("javascript.builtins.Number.NaN")}}</p>

<h2 id="Tambien_mira">Tambien mira</h2>

<ul>
 <li>El objeto global {{jsxref("NaN")}} .</li>
 <li>El objeto {{jsxref("Number")}} al que pertenece.</li>
</ul>