Skip to main content
D
JavaScript
JavaScript Assignment

JavaScript Assignment

JavaScript assignment operators save values into variables.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

JavaScript uses assignment operators to store data inside a variable. The most common assignment operator is the equals sign, but JavaScript provides shortcuts to perform math and assignment simultaneously.

Example

Example
1/* this assigns and updates values */
2let score = 10;
3score += 5; // score is now 15
4score -= 2; // score is now 13

Key Points

  • The `=` operator assigns the exact right-side value.
  • The `+=` operator adds a value to the current variable.
  • The `-=` operator subtracts a value from the current variable.
  • Assignment always reads from right to left.

Up Next

Continue your journey with the next topic.

Go to JS Data Types