Operator

SangwonJeon·2021년 5월 6일
0

Javascript

목록 보기
2/3
post-thumbnail

: 주어진 값에 특정한 작업 처리를 위해 사용하는 기호

typeof 연산자

: 데이터의 타입(자료형)을 알려주는 연산자

const str = 'b';
const num = 2.22;

console.log(typeof str);	// string
console.log(typeof num);	// number

할당 연산자

: 오른쪽의 값을 왼쪽으로 할당
ex) +=, -=, *=, /=, %=...

let num = 3;
num += 1;
console.log(num);	// 4
let str = 'a';
str += 'b';
console.log(str);	// 'ab'

증감 연산자

: 해당 라인의 코드를 실행하기 전/후로 값을 증가하거나 감소 시키는 연산자
ex) ++, --

let num = 1;

console.log(num++);	// 1
console.log(num);	// 2
console.log(++num);	// 3
let num = 1;

console.log(++num);	// 2

자료: 땅콩 코딩 [Youtube]

profile
I will be King of the coding

0개의 댓글