Course Content

Introduction to JavaScript

Operations with Assignment

The readability of the code is very important, so now we will consider the possibilities to make the code more beautiful.

There are math operations with the assignment:

**addition assignment**(`+=`

);**subtraction assignment**(`-=`

);**multiplication assignment**(`*=`

);**division assignment**(`/=`

);**remainder (modulo) assignment**(`%=`

);**exponentiation assignment**(`**=`

).

Assignment operators are used to improve code readability.

Look at the example:

The expression `a += 5`

replaces the `a = a + 5`

.

Let's look at other replacement to understand how it works:

with assignment | default |

`a += 6` | `a = a + 6` |

`a -= 6` | `a = a - 6` |

`a *= 6` | `a = a * 6` |

`a /= 6` | `a = a / 6` |

`a %= 6` | `a = a % 6` |

`a **= 6` | `a = a ** 6` |

Section 3.

Chapter 3