# Source: https://github.com/quick-lint/quick-lint-js/blob/master/docs/errors/E0020.md

# E0020: invalid expression left of assignment

```config-for-examples
{
  "globals": {
    "steps": true,
    "doStep": true,
    "stopNumber": true
  }
}
```

In JavaScript, you can assign to variables or properties. It is a syntax error
to assign to something different, such as the result of a function call or the
result of math:

```javascript
function saveAccount(account, {name, pass}) {
  account.checkPassword(pass);
  account.getName() = name;
  account.getPassword() = pass;
  account.save();
}

for (let step of steps) {
  if (step.index+1 = stopNumber) {
    break;
  }
  doStep(step);
}
```

To fix this error, assign to a variable or property instead, or call a method to
do the assignment:

```javascript
function saveAccount(account, {name, pass}) {
  account.checkPassword(pass);
  account.name = name;
  account.changePassword(pass);
  account.save();
}
```

Alternatively, write `==` or `===` instead of `=`, changing the assignment into
a comparison:

```javascript
for (let step of steps) {
  if (step.index+1 === stopNumber) {
    break;
  }
  doStep(step);
}
```

Introduced in quick-lint-js version 0.2.0.