mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-22 03:26:02 -05:00
1.4 KiB
1.4 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
| id | title | challengeType | videoUrl | forumTopicId | dashedName |
|---|---|---|---|---|---|
| 56533eb9ac21ba0edf2244b0 | Kombination von Zuordnung und Subtraktion | 1 | https://scrimba.com/c/c2Qv7AV | 16660 | compound-assignment-with-augmented-subtraction |
--description--
Ähnlich dem Operator +=, subtrahiert -= eine Zahl von einer Variablen.
myVar = myVar - 5;
subtrahiert 5 von myVar. Dies kann wie folgt umgeschrieben werden:
myVar -= 5;
--instructions--
Ändere die Zuweisungen für a, b und c so, dass sie den Operator -= verwenden.
--hints--
a sollte gleich 5 sein.
assert(a === 5);
b sollte gleich -6 sein.
assert(b === -6);
c sollte gleich 2 sein.
assert(c === 2);
Du solltest den Operator -= für jede Variable verwenden.
assert(code.match(/-=/g).length === 3);
Du solltest den Code oberhalb des vorgegebenen Kommentars nicht verändern.
assert(
/let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code)
);
--seed--
--after-user-code--
(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
--seed-contents--
let a = 11;
let b = 9;
let c = 3;
// Only change code below this line
a = a - 6;
b = b - 15;
c = c - 1;
--solutions--
let a = 11;
let b = 9;
let c = 3;
a -= 6;
b -= 15;
c -= 1;