Files
freeCodeCamp/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md
2024-05-17 10:30:45 +02:00

1.9 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
56533eb9ac21ba0edf2244af 더하기를 추가해서 복합적으로 할당하기 1 https://scrimba.com/c/cDR6LCb 16661 compound-assignment-with-augmented-addition

--description--

프로그래밍에서는 할당을 사용해서 변수의 값을 변경하는 일이 자주 일어납니다. 우선 등호(=) 의 우측 변에 있는 모든 것이 먼저 연산된다는 것을 기억하고 다음을 보세요.

myVar = myVar + 5;

위와 같이 하면 5myVar에 더합니다. 이러한 조작은 일반적인 패턴이므로, 산술 연산과 할당 2가지를 한꺼번에 처리하는 연산자가 있습니다.

그중 하나가 += 연산자입니다.

let myVar = 1;
myVar += 5;
console.log(myVar);

콘솔에 6의 값이 나타날 것입니다.

--instructions--

a, b, 및 c에 대한 할당을 += 연산자를 사용하도록 변환하십시오.

--hints--

a15와 같아야 합니다.

assert(a === 15);

b26과 같아야 합니다.

assert(b === 26);

c19와 같아야 합니다.

assert(c === 19);

각 변수에 += 연산자를 사용해야 합니다.

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

지정된 코멘트 위의 코드를 변경하면 안됩니다.

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

--seed--

--after-user-code--

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

--seed-contents--

let a = 3;
let b = 17;
let c = 12;

// Only change code below this line
a = a + 12;
b = 9 + b;
c = c + 7;

--solutions--

let a = 3;
let b = 17;
let c = 12;

a += 12;
b += 9;
c += 7;