From 9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54 Mon Sep 17 00:00:00 2001 From: SphinxKnight Date: Sun, 27 Jun 2021 15:03:56 +0200 Subject: Fix #756 by updating the JS operators in fr (#1306) * Update Operators landing + revamp L10N for 4 operators * Added NOT / ! - * +multiplication * Addition, exponentiation and comparison * Operateurs de comparaison * Binary ops * Missing newline, thx GH UI * Logical AND / OR * Assignment ops * Conflicting clean-up * Missing EOF newline * Fix history and redirects * FIX: fix flaws * FIX: minox typo fix * FIX: link flaws * FIX: fix tags detection Co-authored-by: tristantheb --- .../operators/addition_assignment/index.html | 85 ++++++++++++---------- 1 file changed, 46 insertions(+), 39 deletions(-) (limited to 'files/fr/web/javascript/reference/operators/addition_assignment/index.html') diff --git a/files/fr/web/javascript/reference/operators/addition_assignment/index.html b/files/fr/web/javascript/reference/operators/addition_assignment/index.html index 6648df2a7f..c0a2136c3d 100644 --- a/files/fr/web/javascript/reference/operators/addition_assignment/index.html +++ b/files/fr/web/javascript/reference/operators/addition_assignment/index.html @@ -1,59 +1,66 @@ --- -title: Addition avec assignement (+=) +title: Affectation après addition (+=) slug: Web/JavaScript/Reference/Operators/Addition_assignment tags: - - Fonctionnalité du language - - JavaScript - - Opérateur - - Opérateur d'assignement - - Reference -translation_of: Web/JavaScript/Reference/Operators/Addition_assignment -original_slug: Web/JavaScript/Reference/Opérateurs/Addition_avec_assignement +- Assignment operator +- JavaScript +- Language feature +- Operator +- Reference +translation-of: Web/JavaScript/Reference/Operators/Addition_assignment +browser-compat: javascript.operators.addition_assignment --- -

{{jsSidebar("Operators")}}

+
{{jsSidebar("Operators")}}
-

L'opérateur d'addition avec assignement (+=) permet d'ajouter une valeur à une variable. Le type des deux valeurs permet de définir si l'utilisation de cet opérateur les concatènera ou les additionnera.

+

L'opérateur d'addition et d'affectation (+=) calcule la somme ou la concaténation de ses deux opérandes puis affecte le résultat à la variable représentée par l'opérande gauche. C'est le type des opérandes qui détermine s'il y a somme ou concaténation.

{{EmbedInteractiveExample("pages/js/expressions-addition-assignment.html")}}
-
+

Syntax

- +
+Opérateur : x += y
+Signification :  x  = x + y
+
-

Syntaxe

+

Exemples

-
Opérateur : x += y
-Signifie :  x = x + y
+

Utiliser l'opérateur d'addition et d'affectation

-

Examples

+
+let toto = "toto";
+let truc = 5;
+let machin = true;
 
-

Utilisation de l'opérateur

+// nombre + nombre -> addition +truc += 2; // 7 -
// On considère les variables suivantes :
-var chaine = "Hello";
-var nombre = 5;
-var booleen = true;
+// booléen + nombre -> addition
+machin += 1; // 2
 
-// Nombre + Nombre
-nombre += 2;
-// 7
+// booléen + booléen -> addition
+machin += false; // 1
 
-// Booléen + Nombre
-booleen += 1;
-// 2
+// nombre + chaîne de caractères -> concaténation
+truc += 'toto'; // "5toto"
 
-// Booléen + Booléen
-booleen += false;
-// 1
+// chaîne de caractères + booléen -> concaténation
+toto += false // "totofalse"
 
-// Nombre + Chaîne
-nombre += "World";
-// "5World"
+// chaîne de caractères + chaîne de caractères -> concaténation
+toto += 'truc' // "tototruc"
-// Chaîne + Booléen -chaine += false; -// "Hellofalse" +

Spécifications

-// Chaîne + Chaîne -chaine += "World" -// "HelloWorld"
+

{{Specifications}}

+ +

Compatibilité des navigateurs

+ +

{{Compat}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf