When
it comes to learning JavaScript, the Boolean objects become inseparable parts
of it. Boolean is actually one among various objects in JavaScript. Basically,
the JavaScript Boolean defines for one among two values, true or false. The
Boolean object becomes the object wrapper for the Boolean value. According to
the description, the value that has passed as
first parameter can be converted to Boolean value when it is necessary. The
object will have initial value of false when the value is omitted. This is the
truth. The primitive Boolean value of false and true is different with Boolean
object values of false and true.
1.
Learn
the Characters of Boolean Values
The
Boolean value is different than other object
values in programming. Usually, there are three different types of values for
the data type. The first data type is YES or NO. The second data type is ON or
OFF. And the third data type is TRUE or FALSE. But when it comes to Boolean
value, there is only one data type. Boolean can take only one among the value
of true or false. By learning about this, you will be able in creating
Boolean objects with an initial value of true.
2.
Learn
the Boolean Properties
Now
that you have learned the basics of Boolean JavaScript, which is about the
values, continue on learning about the Boolean properties. The list of the
Boolean object properties are Constructor and Prototype. The first property,
Constructor has certain description. This property returns reference that has
created the object to Boolean function. Meanwhile, the second property,
Prototype is a property that enables you as programmer in adding Boolean
method and properties to Boolean object.
3.
Learn
the Boolean Methods
Suppose
you have learned about Boolean properties, the next thing to do is to learn
about the Boolean methods. Each method has certain Boolean object and its
description. There are three different Boolean methods that are used in
JavaScript. The first method, toSource() has the capability to return the
string that contains source of objects of Boolean. This is the recommended
method you should use in order to create equivalent object. The second method
known as toString () has the capability to return Boolean string of “false” or
“true” depending on the Boolean object’s value. And the third method called as
valueOf() has the capability to return the Boolean object’s primitive Boolean
value.
4.
Learn
the Boolean Function
Here
is the next step in learning about Boolean JavaScript. The function of the
Boolean can be used to find out whether the variable or expression is true or
false. To find out about this, you have to use the right method from three
different methods available. The use of Boolean value of expression is basically
very important or the fundament for the conditions and comparison of
JavaScript. Further, Boolean can also be used to test the browser
compatibility.
0 komentar:
Posting Komentar