-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
66 lines (45 loc) · 1.81 KB
/
index.md
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
---
title: Adición (+)
slug: Web/JavaScript/Reference/Operators/Addition
---
{{jsSidebar("Operators")}}
El operador de adición (`+`) produce la suma de operandos numéricos o la concatenación de (cadenas) string.
{{EmbedInteractiveExample("pages/js/expressions-addition.html")}}
La fuente para este ejemplo interactivo está almacenado en un repositorio Github. Si te gustaría contribuir al proyecto de ejemplos interactivos, por favor clona <https://github.com/mdn/interactive-examples> y envianos una pull-request.
## Sintaxis
```
Operator: x + y
```
## Ejemplos
### Adición numérica
```js
// Número + Número -> adición
1 + 2; // 3
// Booleano + Número -> adición
true + 1; // 2
// Booleano + Booleano -> adición
false + false; // 0
```
### Concatenación de (cadenas) String
```js
// String + String -> concatenación
"fut" + "bol"; // "futbol"
// Número + String -> concatenación
5 + "oh"; // "5oh"
// String + Booleano -> concatenación
"fut" + false; // "futfalse"
```
## Especificaciones
{{Specifications}}
## Compatibilidad con navegadores
{{Compat}}
## También revisa
- [Subtraction operator](/es/docs/Web/JavaScript/Reference/Operators/Subtraction)
- [Division operator](/es/docs/Web/JavaScript/Reference/Operators/Division)
- [Multiplication operator](/es/docs/Web/JavaScript/Reference/Operators/Multiplication)
- [Remainder operator](/es/docs/Web/JavaScript/Reference/Operators/Remainder)
- [Exponentiation operator](/es/docs/Web/JavaScript/Reference/Operators/Exponentiation)
- [Increment operator](/es/docs/Web/JavaScript/Reference/Operators/Increment)
- [Decrement operator](/es/docs/Web/JavaScript/Reference/Operators/Decrement)
- [Unary negation operator](/es/docs/Web/JavaScript/Reference/Operators/Unary_negation)
- [Unary plus operator](/es/docs/Web/JavaScript/Reference/Operators/Unary_plus)