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

1.4 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244ac JavaScript で数値をインクリメントする 1 https://scrimba.com/c/ca8GLT9 18201 increment-a-number-with-javascript

--description--

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

i++;

は次の式と等価です。

i = i + 1;

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

--instructions--

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

--hints--

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

assert(myVar === 88);

代入演算子は使用しないでください。

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

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

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

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

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

--seed--

--after-user-code--

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

--seed-contents--

let myVar = 87;

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

--solutions--

let myVar = 87;
myVar++;