freeCodeCamp / curriculum

The freeCodeCamp curriculum and lesson editor
Creative Commons Attribution Share Alike 4.0 International
81 stars 124 forks source link

Compound Assignment with Augmented Addition allows unintended solution #292

Open robinmetral opened 5 years ago

robinmetral commented 5 years ago

Describe the bug

The Basic Javascript challenge "Compound Assignment with Augmented Addition" basically asks learners to change: a = a += 12; to: a += 12;

However the testing also allows for this solution: a = a += 12 (which is the one I used because it's quicker to simply add an = sign)

Shouldn't it return an error for this? It should be clear that this compound assignment is intended to remove the first = sign and simplify the code.

Note: this also applies to the three subsequent compound assignment challenges

To Reproduce

Steps to reproduce the behavior:

  1. Go to Compound Assignment with Augmented Addition
  2. Solve the challenge with this code:
    a = a += 12;
    b = b += 9;
    c = c += 7;
  3. See that the tests pass

Expected behavior

Tests to fail.

Desktop (please complete the following information):