aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/operators/bitwise_or
diff options
context:
space:
mode:
authorSphinxKnight <SphinxKnight@users.noreply.github.com>2021-06-27 15:03:56 +0200
committerGitHub <noreply@github.com>2021-06-27 15:03:56 +0200
commit9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54 (patch)
treee6aa6c44ea4c523dbf72464e77745bed1efc8c51 /files/fr/web/javascript/reference/operators/bitwise_or
parentdc9842009bd95e0db7e058a5ebb98f27d6a3f650 (diff)
downloadtranslated-content-9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54.tar.gz
translated-content-9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54.tar.bz2
translated-content-9f030ef5fd3a0dc15d94c01d0e1bbd1aba1eed54.zip
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 <tristantheb@gmail.com>
Diffstat (limited to 'files/fr/web/javascript/reference/operators/bitwise_or')
-rw-r--r--files/fr/web/javascript/reference/operators/bitwise_or/index.html104
1 files changed, 104 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/operators/bitwise_or/index.html b/files/fr/web/javascript/reference/operators/bitwise_or/index.html
new file mode 100644
index 0000000000..72d4ed3043
--- /dev/null
+++ b/files/fr/web/javascript/reference/operators/bitwise_or/index.html
@@ -0,0 +1,104 @@
+---
+title: OU binaire (|)
+slug: Web/JavaScript/Reference/Operators/Bitwise_OR
+tags:
+ - Bitwise operator
+ - JavaScript
+ - Language feature
+ - Operator
+ - Reference
+browser-compat: javascript.operators.bitwise_or
+translation-of: Web/JavaScript/Reference/Operators/Bitwise_OR
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>L'opérateur OU binaire (<code>|</code>) renvoie un nombre dont la représentation binaire est une séquence de bits où il y a un <code>1</code> pour chaque position où au moins un des bits des deux opérandes vaut <code>1</code>.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-bitwise-or.html")}}</div>
+
+<h2 id="syntax">Syntaxe</h2>
+
+<pre class="brush: js">
+<var>a</var> | <var>b</var>
+</pre>
+
+<h2 id="description">Description</h2>
+
+<p>Les opérandes sont convertis en entiers sur 32 bits et exprimés comme une séquence de bits. Les nombres sur plus de 32 bits ont leurs bits en excès écartés. Par exemple, l'entier suivant nécessite plus de 32 bits pour être représenté et il sera converti en un entier sur 32 bits :</p>
+
+<pre class="brush: js">
+Avant: 11100110111110100000000000000110000000000001
+Après: 10100000000000000110000000000001
+</pre>
+
+<p>Chaque bit du premier opérande est associé avec le bit correspondant du second opérande. Lorsqu'au moins un de ces bit vaut 1, le bit correspondant du résultat sera placé à 1. Le résultat est donc construit binairement.</p>
+
+<p>La table de vérité pour l'opérateur OU est :</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th class="header" scope="col">a</th>
+ <th class="header" scope="col">b</th>
+ <th class="header" scope="col">a OU b</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>0</td>
+ <td>0</td>
+ <td>0</td>
+ </tr>
+ <tr>
+ <td>0</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>0</td>
+ <td>1</td>
+ </tr>
+ <tr>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js">
+ 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ 14 (base 10) = 00000000000000000000000000001110 (base 2)
+ --------------------------------
+14 | 9 (base 10) = 00000000000000000000000000001111 (base 2) = 15 (base 10)
+</pre>
+
+<p>Utiliser le OU binaire avec n'importe quel nombre <code><var>x</var></code> d'une part et <code>0</code> renverra toujours <code><var>x</var></code>.</p>
+
+<h2 id="examples">Exemples</h2>
+
+<h3 id="using_bitwise_or">Utiliser l'opérateur OU binaire</h3>
+
+<pre class="brush: js">
+// 9 (00000000000000000000000000001001)
+// 14 (00000000000000000000000000001110)
+
+14 | 9;
+// 15 (00000000000000000000000000001111)
+</pre>
+
+<h2 id="specifications">Spécifications</h2>
+
+<p>{{Specifications}}</p>
+
+<h2 id="browser_compatibility">Compatibilité des navigateurs</h2>
+
+<p>{{Compat}}</p>
+
+<h2 id="see_also">Voir aussi</h2>
+
+<ul>
+ <li><a href="/fr/docs/Web/JavaScript/Guide/Expressions_and_Operators#bitwise">Les opérateurs binaires dans le guide JavaScript</a></li>
+ <li><a href="/fr/docs/Web/JavaScript/Reference/Operators/Bitwise_AND_assignment">L'opérateur ET binaire et d'affectation</a></li>
+</ul>