대입 연산자
let a = 1;
사칙 연산자
let a = 1;
let b = 2;
console.log(a+b);
console.log(a*b);
console.log(a-b);
console.log(a/b);
console.log(a%b);
연결 연산자
let a = "1";
let b = "2";
console.log(a+b); // 12
복합 연산자
let a = 5;
a += 10;
a -= 10;
a *= 10;
a /= 10;
증감 연산자
let a = 10;
a++;
a--;
// 증감 연산자 변수 이름의 오른쪽 a++ => 후위 연산이 적용된 라인 뒤부터 값이 적용
논리 연산자
console.log(!true); // !=not
console.log(true && true) // true AND true
console.log(true && false) // false
console.log(true || false); // true OR false
비교 연산자
let compateA = 1 == "1";
console.log(compareA);
// true => 자바스크립트에서 =을 두번 입력하면 값만 비교,
=을 세번 입력하면 타입도 비교
let compareA = 1 != "1" // false
let compareA = 1 !== "1" // true
대소비교 연산자
let compareA = 1 >= 2; // false
typeof 연산자
let compareA = 1;
compareA = "1";
console.log(typeof compateA); // string
null 병합 연산자
let a;
// 변수 선언하고 값을 할당 하지 않으면 자동으로 undefined
a = a ?? 10;
// 양쪽의 피연산자중에(a,10) null이나 undefined가 아닌것을 선택