Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.2 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
56533eb9ac21ba0edf2244b0 Compound Assignment With Augmented Subtraction 1 16660 compound-assignment-with-augmented-subtraction

--description--

Like the += operator, -= subtracts a number from a variable.

myVar = myVar - 5;

will subtract 5 from myVar. This can be rewritten as:

myVar -= 5;

--instructions--

Convert the assignments for a, b, and c to use the -= operator.

--hints--

a should equal 5.

assert(a === 5);

b should equal -6.

assert(b === -6);

c should equal 2.

assert(c === 2);

You should use the -= operator for each variable.

assert(__helpers.removeJSComments(code).match(/-=/g).length === 3);

You should not modify the code above the specified comment.

assert(
  /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code))
);

--seed--

--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;