in

JAVASCRIPT BOOLEAN | Introduction to Boolean Object in JavaScript

In this tutorial we will be discussing about JavaScript Boolean which entails how to use the Boolean object when coding in JavaScript. In our previous tutorial we looked at JavaScript number object and we explained how to use them when writing JavaScript codes. If you haven’t gone through the tutorial you can do so using the link below

Read previous tutorial on: JAVASCRIPT NUMBER | Introduction To JavaScript Number Object

JAVASCRIPT BOOLEAN OBJECT

Recall that we have been discussing about Boolean in our past tutorials and we explained clearly that the Boolean returns either a TRUE or False value. This is similar to the Boolean object. The Boolean object also returns a TRUE or FALSE value. If values such as 0,-0, false, undefined, null or an empty string the Boolean object has an initial value of false.

BOOLEAN OBJECT SYNTAX

The syntax for Boolean object is shown below

var booVal = new Boolean(Boolean value);

BOOLEAN PROPERTIES

S/N PROPERTY DESCRIPTION
1 Constructor This is used to return a reference back to the Boolean function that was used to create the object
2 prototype This is used to add properties and methods to an object

BOOLEAN METHODS

S/N PROPERTY DESCRIPTION
1 toString() This is use to return a string either TRUE OR FALSE
2 valueOf() This is use to returns the value of the boolean object
3 toSource() This is used to return a string with the object source

NEXT TUTORIAL: JAVASCRIPT STRINGS

What do you think?

javascript numbers

JAVASCRIPT NUMBER | Introduction To JavaScript Number Object

website traffic

How i Increased My Website Traffic in One Month Using Backlinks