Development/Javascript & TypeScript
[Javascript] 이중 느낌표 연산자(Double Exclamation Operator)
아빠는개발자
2023. 2. 14. 12:02
Javascript 에서 이중 느낌표(!!) 연산자는 boolean으로 형 변환을 하는 기능을 합니다.
const a = [1, 2, 3]
const is_a_truthy = !!a; // true
const b = null;
const is_b_truthy = !!b; // false
const c = 0;
const is_c_truthy = !!c; // false
const d = "0";
const is_d_truthy = !!d; // true