Boolean - 참과 거짓을 나타낸다.
let a = true;
let b = new Boolean(true);
let c = 0;
console.log(typeof a);
console.log(typeof b);
console.log(Boolean(c));
a는 boolearn 타입이고, b는 object 타입이다.
선언하는 방식에 따라 타입이 바뀐다. (String도 new String으로 선언하면 object 타입으로 생성된다.)
boolean은 1을 제외한 것은 모두 false로 출력한다.
'프로그래밍 > Java Script' 카테고리의 다른 글
Java Script - 날짜 메소드 Date Method (0) | 2022.12.06 |
---|---|
Java Script - 배열 메소드 array method (0) | 2022.12.05 |
Java Script - 숫자 메소드 Number method (0) | 2022.12.05 |
Java Script - 문자열 메소드 String method (0) | 2022.12.05 |
Java Script - 함수 function (0) | 2022.12.05 |