2.3 Assignment Operators

This is basically syntax sugar. It just makes your code look nicer and cleaner. You can accomplish everything here with the basic arithmetic operators and equal signs.

Assignment Operators

let x = 5, y = 10, z = 15;

x = y;  // x would be 10

x += 1; // x would be 6

x -= 1; // x would be 4

x *= 5; // x would be 25

x /= 5; // x would be 1

x %= 2; // x would be 1

Practice

You can add practice problems here if you want. Follow the format below.

💻 Template code

✅ Solution code

Previous Section

2.2 Arithmetic Operators

Next Section

2.4 Points To Remember About Variables

<aside> ⚖️ Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License.

If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact [email protected] for inquiries.

</aside>