Boolean objects in JavaScript
Boolean objects represent two values, either true or false. If the value parameter is omitted either 0, -0, null, false, NaN, undefined, or an empty string (), the object has an initial value of false.
Describe
Boolean objects represent two values, or "true" or "false". If the value parameter is ignored either 0, -0, null, false, NaN , undefined, or an empty string (""), the object has an initial value of false.
Syntax
Use the following syntax to create a Boolean object.
var val = new Boolean ( value );
Boolean properties
Below is a list of Boolean object properties:
Properties Descriptionconstructor
Returns a reference to the Boolean function that creates that object.prototype
The prototype property allows you to add properties and methods to an object.Boolean methods
Below is a list of methods of the Boolean object and its description:
Method DescriptiontoSource ()
Returns a string containing the source of the Boolean object; You can use this string to create an equivalent object.toString ()
Returns a string: either "true" or "false" depending on the value of the object.valueOf ()
Returns giá trị Primitive của Boolean object.According to Tutorialspoint
Previous article: Object Number in JavaScript
Next lesson: String object in JavaScript
3.5 ★ | 2 Vote
You should read it
- Syntax of JavaScript
- What is JavaScript? Can the Internet exist without JavaScript?
- Browser compatibility in JavaScript
- Boolean in C
- What is Currying in Javascript? How to use Currying in JavaScript
- Things to know about 'this' in JavaScript
- Udemy's top 5 JavaScript courses
- Top site with many good JavaScript exercises to practice
- What is JavaScript?
- ! = and! == What is the difference in JavaScript?
- For ... loop in JavaScript
- Math object in JavaScript
Maybe you are interested
PowerPoint 2016: Arrange and group objects
Can I take photos of moving objects on a smartphone?
AI erases objects in footage in real time, making filming more 'leisurely'
Detecting an unusual object lurking in our Galaxy, possibly a black hole
PowerPoint 2016: Animate text and objects
Instructions for deleting objects in photos on iOS 18