스타트업 트랙 - JS 시작하기 (3)

이동주·2021년 10월 28일

산술, 할당 연산자

1. 산술 연산자(arithmetic operator)

+, -, *, /, % (더하기, 빼기, 곱하기, 나누기, 나머지)

console.log(1 + 2);

console.log(5 - 2);

console.log(1 + 2);

console.log(10 / 2);

console.log(10 % 3);

2. 할당 연산자(assignment operator)

=, +=, -=, *=, /=, %= (eqaul)

const a = 1; // 재할당 불가능

let b = 2; // 재할당 가능
b += 1 // b = b + 1;

console.log(b);
profile
안녕하세요 이동주입니다

0개의 댓글