Use boolean literal true and false to create boolean variable in JavaScript

Description

The following code shows how to use boolean literal true and false to create boolean variable.

Example


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var bFound = true;<!--from w ww  .  java 2 s  . c o  m-->
var bLost = false;
</script>
</head>
<body>
</body>
</html>

Click to view the demo

The code above generates the following result.

Use boolean literal true and false to create boolean variable in JavaScript