aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/operators/bitwise_xor
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_xor
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_xor')
-rw-r--r--files/fr/web/javascript/reference/operators/bitwise_xor/index.html104
1 files changed, 104 insertions, 0 deletions
diff --git a/files/fr/web/javascript/reference/operators/bitwise_xor/index.html b/files/fr/web/javascript/reference/operators/bitwise_xor/index.html
new file mode 100644
index 0000000000..eff1d79f8f
--- /dev/null
+++ b/files/fr/web/javascript/reference/operators/bitwise_xor/index.html
@@ -0,0 +1,104 @@
+---
+title: OU exclusif binaire (^)
+slug: Web/JavaScript/Reference/Operators/Bitwise_XOR
+tags:
+ - Bitwise operator
+ - JavaScript
+ - Language feature
+ - Operator
+ - Reference
+browser-compat: javascript.operators.bitwise_xor
+translation-of: Web/JavaScript/Reference/Operators/Bitwise_XOR
+---
+<div>{{jsSidebar("Operators")}}</div>
+
+<p>L'opérateur binaire OU exclusif (XOR) (<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ù exactement un des bits des deux opérandes vaut <code>1</code>.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/expressions-bitwise-xor.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'exactement 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 exclusif (XOR) 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 XOR 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>0</td>
+ </tr>
+ </tbody>
+</table>
+
+<pre class="brush: js">
+. 9 (base 10) = 00000000000000000000000000001001 (base 2)
+ 14 (base 10) = 00000000000000000000000000001110 (base 2)
+ --------------------------------
+14 ^ 9 (base 10) = 00000000000000000000000000000111 (base 2) = 7 (base 10)
+</pre>
+
+<p>Utiliser le OU exclusif binaire avec n'importe quel nombre <code><var>x</var></code> d'une part et <code>0</code> d'autre part renverra <code><var>x</var></code>.</p>
+
+<h2 id="examples">Exemples</h2>
+
+<h3 id="using_bitwise_xor">Utiliser le OU exclusif binaire</h3>
+
+<pre class="brush: js">
+// 9 (00000000000000000000000000001001)
+// 14 (00000000000000000000000000001110)
+
+14 ^ 9;
+// 7 (00000000000000000000000000000111)
+</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>