Files
2022-01-20 20:30:18 +01:00

1.4 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244ad JavaScript で数値をデクリメントする 1 https://scrimba.com/c/cM2KeS2 17558 decrement-a-number-with-javascript

--description--

-- 演算子を使用して簡単に変数の値を 1 減らす (デクリメントする) ことができます。

i--;

は次の式と等価です。

i = i - 1;

注: この行全体が i--; となり、等号が不要になります。

--instructions--

コードを変更して myVar-- 演算子を使用してください。

--hints--

myVar10 に等しくなる必要があります。

assert(myVar === 10);

myVar = myVar - 1; を書き換える必要があります。

assert(
  /let\s*myVar\s*=\s*11;\s*\/*.*\s*([-]{2}\s*myVar|myVar\s*[-]{2});/.test(code)
);

myVar-- 演算子を使用する必要があります。

assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));

指定のコメントより上にあるコードを変更しないでください。

assert(/let myVar = 11;/.test(code));

--seed--

--after-user-code--

(function(z){return 'myVar = ' + z;})(myVar);

--seed-contents--

let myVar = 11;

// Only change code below this line
myVar = myVar - 1;

--solutions--

let myVar = 11;
myVar--;