Breaking News
yeni film izle hd film seyret film izle

Boolean In Java Script

Boolean type has only two values true and false. These constant values are case-sensitive.
 
Initializing Boolean type variables
 
var present = true
var is JavaScript keyword, present is a variable name, true is value assigned to present variable, variable present is of Boolean type  because the value assigned to present is of  boolean type.
 
In the example given below we have used keyword document.write (message ) which is used to printthe message or variable value given with it.
 
Example 1
 
<html>

<head>

</head>

<body>

<script type=”text/javascript”>

var present = true

var attend = false

document.write(“Student Status in School   : “+present);

document.write(“<br>Class Attended  : “+attend);

</script >

</body>

</html>

 
 
Understanding the program
 
present & absent are two variables of Boolean type having values true and false respectively. <BR> is a html tag used to  insert  a new line.
 
 
Output of this program
 
Student Status in School : true
Class Attended : false

Check Also

Recursive Functions In Java Script

A function which calls itself, is called a recursive function. When A function calls itself …