A boolean variable in JavaScript has two values True or False.
Example
You can try to run the following code to learn how to work with Boolean variables −
<!DOCTYPE html>
<html>
<body>
<p>35 > 20</p>
<button onclick="myValue()">Click for result</button>
<p id="test"></p>
<script>
function myValue() {
document.getElementById("test").innerHTML = Boolean(35 > 20);
}
</script>
</body>
</html>