Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to declare boolean variables in JavaScript?
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>Advertisements