Convert Boolean to string in JavaScript

Description

The following code shows how to convert Boolean to string.

Example


<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
<!--   ww  w. jav a 2  s .  c o m-->
bool = new Boolean(1);
document.write(bool.toString());
</script>
</body>
</html>

Click to view the demo

The code above generates the following result.

Convert Boolean to string in JavaScript