본문 바로가기

Python_WEB/JavaScript

[freecodecamp]JavaScript 복합 대입 연산자 -=

반응형

+= 연산자와 마찬가지로 -=는 변수에서 숫자를 뺍니다.

 

myVar = myVar-5;

 

myVar에서 5를 뺍니다.

다음과 같이 다시 작성할 수 있습니다.

 

myVar -= 5;

 

Q>

1. -= 연산자를 사용하도록 a, b 및 c에 대한 할당을 변환합니다.

2. a는 5와 같아야합니다.

3. b는 -6과 같아야합니다.

4. c는 2와 같아야합니다.

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

6. 지정된 주석 위의 코드를 수정해서는 안됩니다.

 

A>

var a = 11;
var b = 9;
var c = 3;

// Only change code below this line
a -= 6;
b -= 15;
c -= 1;

 

https://www.freecodecamp.org/

 

freeCodeCamp.org

Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.

www.freecodecamp.org

 

반응형