JavaScript Boolean Object - Javascript Objects

What are JavaScript Boolean Objects?

The JavaScript Boolean Object represents either of the given values : “True” or “False”. If Value parameter failed to give a value i.e empty string (“”) or 0, -0, null, false, NaN, or undefined then the initial value of the Object will be treated as false.

Syntax:

Below is the syntax for creating a boolean object.

What are Boolean Properties?

Below are the list of the properties of Boolean object −

Property

Description

Constructor

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

Prototype

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

In the upcoming sections, we will have a few examples which explains the properties of Boolean object.

What are Boolean Methods?

Method

Description

toSource()

This method returns a string containing the source of the Boolean object; one can use this string to create an equivalent object.

toString()

This method returns a string of either "true" or "false" depending upon the value of the object.

valueOf()

This method returns the primitive value of the Boolean object.

In the upcoming sections, we will have a few examples which explains the usage of the Boolean methods.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Javascript Objects Topics