Files
freeCodeCamp/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md
2022-08-19 20:53:29 +02:00

1.4 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244b1 Kombination von Zuordnung und Multiplikation 1 https://scrimba.com/c/c83vrfa 16662 compound-assignment-with-augmented-multiplication

--description--

Der Operator *= multipliziert eine Variable mit einer Zahl.

myVar = myVar * 5;

multipliziert myVar mit 5. 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 25 sein.

assert(a === 25);

b sollte gleich 36 sein.

assert(b === 36);

c sollte gleich 46 sein.

assert(c === 46);

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 = 5;/.test(code) &&
    /let b = 12;/.test(code) &&
    /let c = 4\.6;/.test(code)
);

--seed--

--after-user-code--

(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);

--seed-contents--

let a = 5;
let b = 12;
let c = 4.6;

// Only change code below this line
a = a * 5;
b = 3 * b;
c = c * 10;

--solutions--

let a = 5;
let b = 12;
let c = 4.6;

a *= 5;
b *= 3;
c *= 10;