Use and operator to calculate boolean value from boolean object and boolean literal in JavaScript

Description

The following code shows how to use and operator to calculate boolean value from boolean object and boolean literal.

Example


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
<!--from   w ww .j  a v a  2  s  .  c om-->
var falseObject = new Boolean(false);
var result = falseObject && true;
document.writeln(result);  //true

</script>
</head>
<body>
</body>
</html>

Click to view the demo

The code above generates the following result.

Use and operator to calculate boolean value from boolean object and boolean literal in JavaScript