blob: d29816e37a8b650abb523e5d90a1c264850a7bff (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
---
title: Division (/)
slug: Web/JavaScript/Referencia/Operadores/Division
tags:
- JS
- JavaScript
- Operador de Division
- Operadores
- Referências
translation_of: Web/JavaScript/Reference/Operators/Division
---
<div>{{jsSidebar("Operators")}}</div>
<p>El operador de división (<code>/</code>) produce el cociente de sus operandos donde el operando izquierdo es el dividendo y el operando derecho es el divisor.</p>
<div>{{EmbedInteractiveExample("pages/js/expressions-division.html")}}</div>
<div></div>
<h2 id="Sintaxis">Sintaxis</h2>
<pre class="syntaxbox notranslate"><strong>Operador:</strong> <var>x</var> / <var>y</var>
</pre>
<h2 id="Ejemplos">Ejemplos</h2>
<h3 id="Division_basica">Division basica</h3>
<pre class="brush: js notranslate">1 / 2 // 0.5
Math.floor(3 / 2) // 1
1.0 / 2.0 // 0.5
</pre>
<h3 id="Division_por_cero">Division por cero</h3>
<pre class="brush: js notranslate">2.0 / 0 // Retorna Infinity
2.0 / 0.0 // Retorna Infinity, Dado que 0.0 === 0
2.0 / -0.0 // Retorna -Infinity</pre>
<h2 id="Especificaciones">Especificaciones</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Division operator')}}</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilidad_con_Navegadores">Compatibilidad con Navegadores</h2>
<p>{{Compat("javascript.operators.division")}}</p>
<h2 id="Ver_también">Ver también</h2>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition">Addition operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Subtraction">Subtraction operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Multiplication">Multiplication operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder">Remainder operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation">Exponentiation operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Increment">Increment operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Decrement">Decrement operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unary_negation">Unary negation operator</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unary_plus">Unary plus operator</a></li>
</ul>
|