> For the complete documentation index, see [llms.txt](https://eleven-fifty-academy.gitbook.io/javascript-101-fundamentals/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eleven-fifty-academy.gitbook.io/javascript-101-fundamentals/1-javascript-fundamentals/1-js-fundamentals/5-expressions-and-operators/assignment.md).

# Assignment

Assignment is the process in which a value is placed inside a variable, as previously discussed in variable declarations. There are many different assignment operators, the most common of which is the "=" operator, like this: `let x = 42`. Here are some other common operators that you may see and find useful:

| Name                      | Purpose      | Shorthand |
| ------------------------- | ------------ | --------- |
| Addition Assignment       | `x = x + y`  | `x += y`  |
| Subtraction Assignment    | `x = x - y`  | `x -= y`  |
| Multiplication Assignment | `x = x * y`  | `x *= y`  |
| Division Assignment       | `x = x / y`  | `x /= y`  |
| Remainder Assignment      | `x = x % y`  | `x %= y`  |
| Exponential Assignment    | `x = x ** y` | `x **= y` |

The exponential operator `**` is a newly introduced feature of ES7, or ES 2016. In mathematical notation, it would be written as x ^ y (or x to the power of y), and it acts the same as the `Math.exp()` function. However, it has not yet been standardized for use in production, so it may not work as intended in all browsers. Use it with caution.

## String Operators

Some assignment operators can also be used with strings, such as `let x = 'testing'`. String concatenation is another example of this.

## File Location

We will be working in the following file:

```
    javascript-library
        └── 0-PreWork
        └── 1-Fundamentals
            └── 1-Grammar-and-Types
            └── 2-ControlFlow-and-ErrorHandling
            └── 3-Loops
            └── 4-Functions
            └── 5-Expressions-and-Operators
                01-assignment.js <----You will be working in this file.
```

## Practice

1. In `assignment.js`, create a variable and assign it a value.
2. Use each of the shorthand assignment operators and print the results of each to the console.
3. Create another variable and assign it a string value.&#x20;
4. Use each assignment operator on this variable and print the results to the console.&#x20;
5. Are these results what you expected? Why or why not?
