JavaScript-부울 객체

그만큼 Booleanobject는 "true"또는 "false"의 두 값을 나타냅니다. 경우 파라미터가 생략되거나 0이되어, -O, NULL, 거짓NaN, 정의되지 않았거나 빈 문자열 ( "") 인 개체의 초기 값은 false입니다.

통사론

다음 구문을 사용하여 boolean 목적.

var val = new Boolean(value);

부울 속성

다음은 부울 객체의 속성 목록입니다.

Sr. 아니. 속성 및 설명
1 constructor

Returns a reference to the Boolean function that created the object.

2 prototype

The prototype property allows you to add properties and methods to an object.

In the following sections, we will have a few examples to illustrate the properties of Boolean object.

Boolean Methods

Here is a list of the methods of Boolean object and their description.

Sr.No. Method & Description
1 toSource()

Returns a string containing the source of the Boolean object; you can use this string to create an equivalent object.

2 toString()

Returns a string of either "true" or "false" depending upon the value of the object.

3 valueOf()

Returns the primitive value of the Boolean object.

In the following sections, we will have a few examples to demonstrate the usage of the Boolean methods.