Boolean 값을 감싸고있는 객체이다.
첫 번째 파라미터를 Boolean 타입으로 변환한다.
0 -0 null false NaN undefined """false"를 포함한 그 외의 값❗️ Boolean 객체의 true false와 원시 Boolean 값 true flase를 혼동하지 말자!
const x = new Boolean(false)
const y = false
if (x) console.log("hello")
if (y) console.log("bye")
콘솔 로그 출력값
> hello
x 는 Boolean 객체이기 때문에, 원시 Boolean 값은 true이다. 따라서 "hello"가 출력된다.
const x = new Boolean(false)
x.toString() // "false" 출력
const y = new Boolean(true)
y.toString() // "true" 출력
"true" 혹은 "false"를 반환한다.const x = new Boolean(false)
x.valueOf() // false 출력
const y = new Boolean(true)
y.valueOf() // true 출력