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/left_shift/index.html | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 files/fr/web/javascript/reference/operators/left_shift/index.html (limited to 'files/fr/web/javascript/reference/operators/left_shift') diff --git a/files/fr/web/javascript/reference/operators/left_shift/index.html b/files/fr/web/javascript/reference/operators/left_shift/index.html new file mode 100644 index 0000000000..325adc9947 --- /dev/null +++ b/files/fr/web/javascript/reference/operators/left_shift/index.html @@ -0,0 +1,62 @@ +--- +title: Décalage binaire à gauche (<<) +slug: Web/JavaScript/Reference/Operators/Left_shift +tags: + - Bitwise operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.left_shift +translation-of: Web/JavaScript/Reference/Operators/Left_shift +--- +
{{jsSidebar("Operators")}}
+ +

L'opérateur de décalage binaire à gauche (<<) décale la séquence de bits représentée par le premier opérande d'autant de bits vers la gauche que le nombre indiqué par le second opérande. Les bits en excès à gauche sont écartés et des bits à zéro sont introduits à droite.

+ +
{{EmbedInteractiveExample("pages/js/expressions-left-shift.html")}}
+ +

Syntaxe

+ +
+a << b
+
+ +

Description

+ +

Cet opérateur décale les bits du premier opérande vers la gauche, d'autant que le nombre indiqué par le second opérande. Les bits qui dépassent à gauche sont abandonnés et des zéros sont introduits à droite.

+ +

Ainsi, 9 << 2 donnera la valeur 36 (en base 10) :

+ +
+       9 (base 10): 00000000000000000000000000001001 (base 2)
+                    --------------------------------
+  9 << 2 (base 10): 00000000000000000000000000100100 (base 2) = 36 (base 10)
+
+ +

Le décalage binaire de tout nombre x de y bits vers la gauche donnera comme résultat x * 2 ** y. Par exemple, 9 << 3 pourra être reformulé en 9 * (2 ** 3) = 9 * (8) = 72.

+ +

Exemples

+ +

Utiliser le décalage binaire à gauche

+ +
+9 << 3; // 72
+
+// 9 * (2 ** 3) = 9 * (8) = 72
+
+ +

Spécifications

+ +

{{Specifications}}

+ +

Compatibilité des navigateurs

+ +

{{Compat}}

+ +

Voir aussi

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