
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 create a Boolean object in JavaScript?
The Boolean object represents two values, either "true" or "false". If the value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false.
Create a Boolean object like this −
var val = new Boolean(value);
Example
You can try to run the following code to learn how to create a Boolean object −
<html> <head> <title>JavaScript toString() Method</title> </head> <body> <script> var flag = new Boolean(true); document.write( "flag.toString is : " + flag.toString() ); </script> </body> </html>
- Related Questions & Answers
- Create a Boolean object from Boolean value in Java
- How to create a multidimensional JavaScript object?
- How to create a custom object in JavaScript?
- How to create a Date object in JavaScript?
- Convert Java Boolean Primitive to Boolean object
- How to create a Number object using JavaScript?
- How to create a URL object using JavaScript?
- How to declare a boolean in JavaScript?
- What are the properties of a boolean object in JavaScript?
- What are the methods of a boolean object in JavaScript?
- How to create object properties in JavaScript?
- How to create RegExp object in JavaScript?
- Convert Java String Object to Boolean Object
- How to toggle a boolean using JavaScript?
- Parse a string to a Boolean object in Java
Advertisements