Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1104689 of Assignment operators

  • Revision slug: Web/JavaScript/Reference/Operators/Assignment_Operators
  • Revision title: Assignment operators
  • Revision id: 1104689
  • Created:
  • Creator: torazaburo
  • Is current revision? Yes
  • Comment

Revision Content

{{jsSidebar("Operators")}}

An assignment operator assigns a value to its left operand based on the value of its right operand.

Overview

The basic assignment operator is equal (=), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x. The other assignment operators are usually shorthand for standard operations, as shown in the following definitions and examples.

Name Shorthand operator Meaning
Assignment x = y x = y
Addition assignment x += y x = x + y
Subtraction assignment x -= y x = x - y
Multiplication assignment x *= y x = x * y
Division assignment x /= y x = x / y
Remainder assignment x %= y x = x % y
Exponentiation assignment x **= y x = x ** y
Left shift assignment x <<= y x = x << y
Right shift assignment x >>= y x = x >> y
Unsigned right shift assignment x >>>= y x = x >>> y
Bitwise AND assignment x &= y x = x & y
Bitwise XOR assignment x ^= y x = x ^ y
Bitwise OR assignment x |= y x = x | y

Assignment

Simple assignment operator which assigns a value to a variable. The assignment operation evaluates to the assigned value. Chaining the assignment operator is possible in order to assign a single value to multiple variables. See the example.

Syntax

Operator: x = y

Examples

// Assuming the following variables
//  x = 5
//  y = 10
//  z = 25

x = y     // x is 10
x = y = z // x, y and z are all 25

Addition assignment

The addition assignment operator adds the value of the right operand to a variable and assigns the result to the variable. The types of the two operands determine the behavior of the addition assignment operator. Addition or concatenation is possible. See the {{jsxref("Operators/Arithmetic_Operators", "addition operator", "#Addition", 1)}} for more details.

Syntax

Operator: x += y 
Meaning:  x  = x + y

Examples

// Assuming the following variables
//  foo = "foo"
//  bar = 5
//  baz = true


// Number + Number -> addition
bar += 2 // 7

// Boolean + Number -> addition
baz += 1 // 2

// Boolean + Boolean -> addition
baz += false // 1

// Number + String -> concatenation
bar += "foo" // "5foo"

// String + Boolean -> concatenation
foo += false // "foofalse"

// String + String -> concatenation
foo += "bar" // "foobar"

Subtraction assignment

The subtraction assignment operator subtracts the value of the right operand from a variable and assigns the result to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "subtraction operator", "#Subtraction", 1)}} for more details.

Syntax

Operator: x -= y 
Meaning:  x  = x - y

Examples

// Assuming the following variable
//  bar = 5

bar -= 2     // 3
bar -= "foo" // NaN

Multiplication assignment

The multiplication assignment operator multiplies a variable by the value of the right operand and assigns the result to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "multiplication operator", "#Multiplication", 1)}} for more details.

Syntax

Operator: x *= y 
Meaning:  x  = x * y

Examples

// Assuming the following variable
//  bar = 5

bar *= 2     // 10
bar *= "foo" // NaN

Division assignment

The division assignment operator divides a variable by the value of the right operand and assigns the result to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "division operator", "#Division", 1)}} for more details.

Syntax

Operator: x /= y 
Meaning:  x  = x / y

Examples

// Assuming the following variable
//  bar = 5

bar /= 2     // 2.5
bar /= "foo" // NaN
bar /= 0     // Infinity

Remainder assignment

The remainder assignment operator divides a variable by the value of the right operand and assigns the remainder to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "remainder operator", "#Remainder", 1)}} for more details.

Syntax

Operator: x %= y 
Meaning:  x  = x % y

Examples

// Assuming the following variable
//  bar = 5

bar %= 2     // 1
bar %= "foo" // NaN
bar %= 0     // NaN

Exponentiation assignment

{{es7}}

The exponentiation assignment operator evaluates to the result of raising first operand to the power second operand. See the {{jsxref("Operators/Arithmetic_Operators", "exponentiation operator", "#Exponentiation", 1)}} for more details.

Syntax

Operator: x **= y 
Meaning:  x  = x ** y

Examples

// Assuming the following variable
//  bar = 5

bar **= 2     // 25
bar **= "foo" // NaN

Left shift assignment

The left shift assignment operator moves the specified amount of bits to the left and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "left shift operator", "#Left_shift", 1)}} for more details.

Syntax

Operator: x <<= y 
Meaning:  x   = x << y

Examples

var bar = 5; //  (00000000000000000000000000000101)
bar <<= 2; // 20 (00000000000000000000000000010100)

Right shift assignment

The right shift assignment operator moves the specified amount of bits to the right and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "right shift operator", "#Right_shift", 1)}} for more details.

Syntax

Operator: x >>= y 
Meaning:  x   = x >> y

Examples

var bar = 5; //   (00000000000000000000000000000101)
bar >>= 2;   // 1 (00000000000000000000000000000001)

var bar -5; //    (-00000000000000000000000000000101)
bar >>= 2;  // -2 (-00000000000000000000000000000010)

Unsigned right shift assignment

The unsigned right shift assignment operator moves the specified amount of bits to the right and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", " unsigned right shift operator", "#Unsigned_right_shift", 1)}} for more details.

Syntax

Operator: x >>>= y 
Meaning:  x    = x >>> y

Examples

var bar = 5; //   (00000000000000000000000000000101)
bar >>>= 2;  // 1 (00000000000000000000000000000001)

var bar = -5; // (-00000000000000000000000000000101)
bar >>>= 2; // 1073741822 (00111111111111111111111111111110)

Bitwise AND assignment

The bitwise AND assignment operator uses the binary representation of both operands, does a bitwise AND operation on them and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "bitwise AND operator", "#Bitwise_AND", 1)}} for more details.

Syntax

Operator: x &= y 
Meaning:  x  = x & y

Example

var bar = 5;
// 5:     00000000000000000000000000000101
// 2:     00000000000000000000000000000010
bar &= 2; // 0

Bitwise XOR assignment

The bitwise XOR assignment operator uses the binary representation of both operands, does a bitwise XOR operation on them and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "bitwise XOR operator", "#Bitwise_XOR", 1)}} for more details.

Syntax

Operator: x ^= y 
Meaning:  x  = x ^ y

Example

var bar = 5;
bar ^= 2; // 7
// 5: 00000000000000000000000000000101
// 2: 00000000000000000000000000000010
// -----------------------------------
// 7: 00000000000000000000000000000111

Bitwise OR assignment

The bitwise OR assignment operator uses the binary representation of both operands, does a bitwise OR operation on them and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "bitwise OR operator", "#Bitwise_OR", 1)}} for more details.

Syntax

Operator: x |= y 
Meaning:  x  = x | y

Example

var bar = 5;
bar |= 2; // 7
// 5: 00000000000000000000000000000101
// 2: 00000000000000000000000000000010
// -----------------------------------
// 7: 00000000000000000000000000000111

Examples

Left operand with another assignment operator

In unusual situations, the assignment operator (e.g. x += y) is not identical to the meaning expression (here x = x + y). When the left operand of an assignment operator itself contains an assignment operator, the left operand is evaluated only once. For example:

a[i++] += 5         // i is evaluated only once
a[i++] = a[i++] + 5 // i is evaluated twice

Specifications

Specification Status Comment
{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}} {{Spec2('ESDraft')}}  
{{SpecName('ES6', '#sec-assignment-operators', 'Assignment operators')}} {{Spec2('ES6')}}  
{{SpecName('ES5.1', '#sec-11.13', 'Assignment operators')}} {{Spec2('ES5.1')}}  
{{SpecName('ES1', '#sec-11.13', 'Assignment operators')}} {{Spec2('ES1')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

See also

Revision Source

<div>{{jsSidebar("Operators")}}</div>

<p>An <strong>assignment operator</strong> assigns a value to its left operand based on the value of its right operand.</p>

<h2 id="Overview">Overview</h2>

<p>The basic assignment operator is equal (<code>=</code>), which assigns the value of its right operand to its left operand. That is, <code>x = y</code> assigns the value of <code>y</code> to <code>x</code>. The other assignment operators are usually shorthand for standard operations, as shown in the following definitions and examples.</p>

<table class="standard-table">
 <tbody>
  <tr>
   <th>Name</th>
   <th>Shorthand operator</th>
   <th>Meaning</th>
  </tr>
  <tr>
   <td><a href="#Assignment">Assignment</a></td>
   <td><code>x = y</code></td>
   <td><code>x = y</code></td>
  </tr>
  <tr>
   <td><a href="#Addition_assignment">Addition assignment</a></td>
   <td><code>x += y</code></td>
   <td><code>x = x + y</code></td>
  </tr>
  <tr>
   <td><a href="#Subtraction_assignment">Subtraction assignment</a></td>
   <td><code>x -= y</code></td>
   <td><code>x = x - y</code></td>
  </tr>
  <tr>
   <td><a href="#Multiplication_assignment">Multiplication assignment</a></td>
   <td><code>x *= y</code></td>
   <td><code>x = x * y</code></td>
  </tr>
  <tr>
   <td><a href="#Division_assignment">Division assignment</a></td>
   <td><code>x /= y</code></td>
   <td><code>x = x / y</code></td>
  </tr>
  <tr>
   <td><a href="#Remainder_assignment">Remainder assignment</a></td>
   <td><code>x&nbsp;%= y</code></td>
   <td><code>x = x&nbsp;% y</code></td>
  </tr>
  <tr>
   <td><a href="#Exponentiation_assignment">Exponentiation assignment</a></td>
   <td><code>x **= y</code></td>
   <td><code>x = x ** y</code></td>
  </tr>
  <tr>
   <td><a href="#Left_shift_assignment">Left shift assignment</a></td>
   <td><code>x &lt;&lt;= y</code></td>
   <td><code>x = x &lt;&lt; y</code></td>
  </tr>
  <tr>
   <td><a href="#Right_shift_assignment">Right shift assignment</a></td>
   <td><code>x &gt;&gt;= y</code></td>
   <td><code>x = x &gt;&gt; y</code></td>
  </tr>
  <tr>
   <td><a href="#Unsigned_right_shift_assignment">Unsigned right shift assignment</a></td>
   <td><code>x &gt;&gt;&gt;= y</code></td>
   <td><code>x = x &gt;&gt;&gt; y</code></td>
  </tr>
  <tr>
   <td><a href="#Bitwise_AND_assignment">Bitwise AND assignment</a></td>
   <td><code>x &amp;= y</code></td>
   <td><code>x = x &amp; y</code></td>
  </tr>
  <tr>
   <td><a href="#Bitwise_XOR_assignment">Bitwise XOR assignment</a></td>
   <td><code>x ^= y</code></td>
   <td><code>x = x ^ y</code></td>
  </tr>
  <tr>
   <td><a href="#Bitwise_OR_assignment">Bitwise OR assignment</a></td>
   <td><code>x |= y</code></td>
   <td><code>x = x | y</code></td>
  </tr>
 </tbody>
</table>

<h2 id="Assignment_2"><a name="Assignment">Assignment</a></h2>

<p>Simple assignment operator which assigns a value to a variable. The assignment operation&nbsp;evaluates to&nbsp;the assigned value. Chaining the assignment operator is possible in order to assign a single value to multiple variables. See the example.</p>

<h3 id="Syntax">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x = y
</pre>

<h3 id="Examples">Examples</h3>

<pre class="brush: js">
// Assuming the following variables
//  x = 5
//  y = 10
//  z = 25

x = y     // x is 10
x = y = z // x, y and z are all 25
</pre>

<h2 id="Addition_assignment_2"><a name="Addition_assignment">Addition assignment</a></h2>

<p>The addition assignment operator <strong>adds</strong> the value of the right operand to a variable and assigns the result to the variable. The types of the two operands determine the behavior of the addition assignment operator. Addition or concatenation is possible. See the {{jsxref("Operators/Arithmetic_Operators", "addition operator", "#Addition", 1)}} for more details.</p>

<h3 id="Syntax_2">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x += y 
<strong>Meaning:</strong>  x  = x + y
</pre>

<h3 id="Examples_2">Examples</h3>

<pre class="brush: js">
// Assuming the following variables
//  foo = "foo"
//  bar = 5
//  baz = true


// Number + Number -&gt; addition
bar += 2 // 7

// Boolean + Number -&gt; addition
baz += 1 // 2

// Boolean + Boolean -&gt; addition
baz += false // 1

// Number + String -&gt; concatenation
bar += "foo" // "5foo"

// String + Boolean -&gt; concatenation
foo += false // "foofalse"

// String + String -&gt; concatenation
foo += "bar" // "foobar"
</pre>

<h2 id="Subtraction_assignment_2"><a name="Subtraction_assignment">Subtraction assignment</a></h2>

<p>The subtraction assignment operator <strong>subtracts</strong> the value of the right operand from a variable and assigns the result to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "subtraction operator", "#Subtraction", 1)}} for more details.</p>

<h4 id="Syntax_3">Syntax</h4>

<pre class="syntaxbox">
<strong>Operator:</strong> x -= y 
<strong>Meaning:</strong>  x  = x - y
</pre>

<h4 id="Examples_3">Examples</h4>

<pre class="brush: js">
// Assuming the following variable
//  bar = 5

bar -= 2     // 3
bar -= "foo" // NaN
</pre>

<h2 id="Multiplication_assignment_2"><a name="Multiplication_assignment">Multiplication assignment</a></h2>

<p>The multiplication assignment operator <strong>multiplies</strong> a variable by the value of the right operand and assigns the result to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "multiplication operator", "#Multiplication", 1)}} for more details.</p>

<h3 id="Syntax_4">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x *= y 
<strong>Meaning:</strong>  x  = x * y
</pre>

<h3 id="Examples_4">Examples</h3>

<pre class="brush: js">
// Assuming the following variable
//  bar = 5

bar *= 2     // 10
bar *= "foo" // NaN
</pre>

<h2 id="Division_assignment_2"><a name="Division_assignment">Division assignment</a></h2>

<p>The division assignment operator <strong>divides</strong> a variable by the value of the right operand and assigns the result to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "division operator", "#Division", 1)}} for more details.</p>

<h3 id="Syntax_5">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x /= y 
<strong>Meaning:</strong>  x  = x / y
</pre>

<h3 id="Examples_5">Examples</h3>

<pre class="brush: js">
// Assuming the following variable
//  bar = 5

bar /= 2     // 2.5
bar /= "foo" // NaN
bar /= 0     // Infinity
</pre>

<h2 id="Remainder_assignment_2"><a name="Remainder_assignment">Remainder assignment</a></h2>

<p>The remainder assignment operator <strong>divides</strong> a variable by the value of the right operand and assigns the <strong>remainder</strong> to the variable. See the {{jsxref("Operators/Arithmetic_Operators", "remainder operator", "#Remainder", 1)}} for more details.</p>

<h3 id="Syntax_6">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x %= y 
<strong>Meaning:</strong>  x  = x % y
</pre>

<h3 id="Examples_6">Examples</h3>

<pre class="brush: js">
// Assuming the following variable
//  bar = 5

bar %= 2     // 1
bar %= "foo" // NaN
bar %= 0     // NaN
</pre>

<h2 id="Exponentiation_assignment_2"><a id="Exponentiation_assignment" name="Exponentiation_assignment">Exponentiation assignment</a></h2>

<p>{{es7}}</p>

<p>The exponentiation assignment operator evaluates to the result of raising first operand to the <strong>power</strong> second operand. See the {{jsxref("Operators/Arithmetic_Operators", "exponentiation operator", "#Exponentiation", 1)}} for more details.</p>

<h3 id="Syntax_7">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x **= y 
<strong>Meaning:</strong>  x  = x ** y
</pre>

<h3 id="Examples_7">Examples</h3>

<pre class="brush: js">
// Assuming the following variable
//  bar = 5

bar **= 2     // 25
bar **= "foo" // NaN</pre>

<h2 id="Left_shift_assignment_2"><a name="Left_shift_assignment">Left shift assignment</a></h2>

<p>The left shift assignment operator moves the specified amount of bits to the left and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "left shift operator", "#Left_shift", 1)}} for more details.</p>

<h3 id="Syntax_8">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x &lt;&lt;= y 
<strong>Meaning:</strong>  x   = x &lt;&lt; y
</pre>

<h3 id="Examples_8">Examples</h3>

<pre class="brush: js">
var bar = 5; //  (00000000000000000000000000000101)
bar &lt;&lt;= 2; // 20 (00000000000000000000000000010100)
</pre>

<h2 id="Right_shift_assignment_2"><a name="Right_shift_assignment">Right shift assignment</a></h2>

<p>The right shift assignment operator moves the specified amount of bits to the right and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "right shift operator", "#Right_shift", 1)}} for more details.</p>

<h3 id="Syntax_9">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x &gt;&gt;= y 
<strong>Meaning:</strong>  x   = x &gt;&gt; y
</pre>

<h3 id="Examples_9">Examples</h3>

<pre class="brush: js">
var bar = 5; //   (00000000000000000000000000000101)
bar &gt;&gt;= 2;   // 1 (00000000000000000000000000000001)

var bar -5; //    (-00000000000000000000000000000101)
bar &gt;&gt;= 2;  // -2 (-00000000000000000000000000000010)
</pre>

<h2 id="Unsigned_right_shift_assignment_2"><a name="Unsigned_right_shift_assignment">Unsigned right shift assignment</a></h2>

<p>The unsigned right shift assignment operator moves the specified amount of bits to the right and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", " unsigned right shift operator", "#Unsigned_right_shift", 1)}} for more details.</p>

<h3 id="Syntax_10">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x &gt;&gt;&gt;= y 
<strong>Meaning:</strong>  x    = x &gt;&gt;&gt; y
</pre>

<h3 id="Examples_10">Examples</h3>

<pre class="brush: js">
var bar = 5; //   (00000000000000000000000000000101)
bar &gt;&gt;&gt;= 2;  // 1 (00000000000000000000000000000001)

var bar = -5; // (-00000000000000000000000000000101)
bar &gt;&gt;&gt;= 2; // 1073741822 (00111111111111111111111111111110)</pre>

<h2 id="Bitwise_AND_assignment_2"><a name="Bitwise_AND_assignment">Bitwise AND assignment</a></h2>

<p>The bitwise AND assignment operator uses the binary representation of both operands, does a bitwise AND operation on them and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "bitwise AND operator", "#Bitwise_AND", 1)}} for more details.</p>

<h3 id="Syntax_11">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x &amp;= y 
<strong>Meaning:</strong>  x  = x &amp; y
</pre>

<h3 id="Example">Example</h3>

<pre class="brush: js">
var bar = 5;
// 5:     00000000000000000000000000000101
// 2:     00000000000000000000000000000010
bar &amp;= 2; // 0
</pre>

<h2 id="Bitwise_XOR_assignment_2"><a name="Bitwise_XOR_assignment">Bitwise XOR assignment</a></h2>

<p>The bitwise XOR assignment operator uses the binary representation of both operands, does a bitwise XOR operation on them and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "bitwise XOR operator", "#Bitwise_XOR", 1)}} for more details.</p>

<h3 id="Syntax_12">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x ^= y 
<strong>Meaning:</strong>  x  = x ^ y
</pre>

<h3 id="Example_2">Example</h3>

<pre class="brush: js">
var bar = 5;
bar ^= 2; // 7
// 5: 00000000000000000000000000000101
// 2: 00000000000000000000000000000010
// -----------------------------------
// 7: 00000000000000000000000000000111
</pre>

<h2 id="Bitwise_OR_assignment_2"><a name="Bitwise_OR_assignment">Bitwise OR assignment</a></h2>

<p>The bitwise OR assignment operator uses the binary representation of both operands, does a bitwise OR operation on them and assigns the result to the variable. See the {{jsxref("Operators/Bitwise_Operators", "bitwise OR operator", "#Bitwise_OR", 1)}} for more details.</p>

<h3 id="Syntax_13">Syntax</h3>

<pre class="syntaxbox">
<strong>Operator:</strong> x |= y 
<strong>Meaning:</strong>  x  = x | y
</pre>

<h3 id="Example_3">Example</h3>

<pre class="brush: js">
var bar = 5;
bar |= 2; // 7
// 5: 00000000000000000000000000000101
// 2: 00000000000000000000000000000010
// -----------------------------------
// 7: 00000000000000000000000000000111
</pre>

<h2 id="Examples_11">Examples</h2>

<h3 id="Left_operand_with_another_assignment_operator">Left operand with another assignment operator</h3>

<p>In unusual situations, the assignment operator (e.g.<code> x += y</code>) is not identical to the meaning expression (here <code>x = x + y</code>). When the left operand of an assignment operator itself contains an assignment operator, the left operand is evaluated only once. For example:</p>

<pre class="brush: js">
a[i++] += 5         // i is evaluated only once
a[i++] = a[i++] + 5 // i is evaluated twice
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-assignment-operators', 'Assignment operators')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-11.13', 'Assignment operators')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('ES1', '#sec-11.13', 'Assignment operators')}}</td>
   <td>{{Spec2('ES1')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators">Arithmetic operators</a></li>
</ul>
Revert to this revision