freeCodeCamp/curriculum/challenges/italian/02-javascript-algorithms-an.../basic-javascript/compound-assignment-with-au...

1.4 KiB

id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244b1 Assegnazione composta con moltiplicazione aumentata 1 https://scrimba.com/c/c83vrfa 16662 compound-assignment-with-augmented-multiplication

--description--

L'operatore *= moltiplica una variabile per un numero.

myVar = myVar * 5;

moltiplicherà myVar per 5. Questo può essere riscritto come:

myVar *= 5;

--instructions--

Converti le assegnazioni per a, b e c in modo da utilizzare l'operatore *=.

--hints--

a dovrebbe essere uguale a 25.

assert(a === 25);

b dovrebbe essere uguale a 36.

assert(b === 36);

c dovrebbe essere uguale a 46.

assert(c === 46);

Dovresti usare l'operatore *= per ogni variabile.

assert(code.match(/\*=/g).length === 3);

Non dovresti modificare il codice sopra il commento specificato.

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;