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 --- .../reference/operators/strict_equality/index.html | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 files/fr/web/javascript/reference/operators/strict_equality/index.html (limited to 'files/fr/web/javascript/reference/operators/strict_equality/index.html') diff --git a/files/fr/web/javascript/reference/operators/strict_equality/index.html b/files/fr/web/javascript/reference/operators/strict_equality/index.html new file mode 100644 index 0000000000..ba45dffaae --- /dev/null +++ b/files/fr/web/javascript/reference/operators/strict_equality/index.html @@ -0,0 +1,100 @@ +--- +title: Égalité stricte (===) +slug: Web/JavaScript/Reference/Operators/Strict_equality +tags: + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.strict_equality +translation-of: Web/JavaScript/Reference/Operators/Strict_equality +--- +
{{jsSidebar("Operators")}}
+ +

L'opérateur d'égalité stricte (===) vérifie si ses deux opérandes sont égaux et renvoie un booléen correspondant au résultat. À la différence de l'opérateur d'égalité, l'opérateur d'égalité stricte considère toujours des opérandes de types différents comme étant différents.

+ +
{{EmbedInteractiveExample("pages/js/expressions-strict-equality.html")}}
+ +

Syntaxe

+ +
+x === y
+
+ +

Description

+ +

Les opérateurs d'égalité stricte (=== et !==) utilisent l'algorithme de comparaison d'égalité stricte pour comparer deux opérandes.

+ + + +

La différence fondamentale avec l'opérateur d'égalité (==) est que, lorsque les opérandes sont de types différents, == tentera une conversion vers un type commun avant la comparaison.

+ +

Exemples

+ +

Comparaison d'opérandes de même type

+ +
+console.log("hello" === "hello");   // true
+console.log("hello" === "hola");    // false
+
+console.log(3 === 3);               // true
+console.log(3 === 4);               // false
+
+console.log(true === true);         // true
+console.log(true === false);        // false
+
+console.log(null === null);         // true
+
+ +

Comparaison d'opérandes de types différents

+ +
+console.log("3" === 3);           // false
+
+console.log(true === 1);          // false
+
+console.log(null === undefined);  // false
+
+ +

Comparaison d'objets

+ +
+const objet1 = {
+  name: "coucou"
+}
+
+const objet2 = {
+  name: "coucou"
+}
+
+console.log(objet1 === objet2);  // false
+console.log(objet1 === objet1);  // true
+
+ +

Spécifications

+ +

{{Specifications}}

+ +

Compatibilité des navigateurs

+ +

{{Compat}}

+ +

Voir aussi

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