aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/operators/left_shift_assignment/index.md
blob: a19e39c4f84aeaac2c02c58efb7063f427419804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: Affectation après décalage à gauche (<<=)
slug: Web/JavaScript/Reference/Operators/Left_shift_assignment
tags:
  - Assignment operator
  - JavaScript
  - Language feature
  - Operator
  - Reference
browser-compat: javascript.operators.left_shift_assignment
---
{{jsSidebar("Operators")}}

L'opérateur de décalage à gauche et d'affectation (`<<=`) décale la séquence de bits représentée par l'opérande gauche d'autant de bits qu'indiqué par l'opérande droit puis affecte le résultat obtenu à la variable représentée par l'opérande gauche.

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

## Syntaxe

```js
Opérateur : x <<= y
Signification :  x   = x << y
```

## Exemples

### Utiliser l'opérateur de décalage à gauche et d'affectation

```js
let a = 5;
// 00000000000000000000000000000101

a <<= 2; // 20
// 00000000000000000000000000010100
```

## Spécifications

{{Specifications}}

## Compatibilité des navigateurs

{{Compat}}

## Voir aussi

- [Les opérateurs d'affectation dans le guide JavaScript](/fr/docs/Web/JavaScript/Guide/Expressions_and_Operators#assignment)
- [L'opérateur de décalage à gauche binaire](/fr/docs/Web/JavaScript/Reference/Operators/Left_shift)