×

Html & Html5

it training classes Logo

The World's best Software Development Study Portal

Js Boolean


JS boolean object represent the two states of values i.e. true or false We can also create the Javascript Boolean by using Boolean() constructor

We can also construct the number object using Number () constructor.


Boolean b = new Boolean(value);

Let's take an example:-

<html>

<body>

<script>

   var x=18;

   document.write(20>18);

</script>

</body>

</html>

Output of this program

True



Some Boolean properties and methods are described below :-

Methods/Property Description
prototype this property enables you to add properties and methods in Boolean prototype
constructor this property use to return the reference of Boolean function that created Boolean object.
toSource() returns the source of Boolean object as a string.
valueOf() converts other type into Boolean.
toString() converts Boolean into String.






JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute