Boolean objects in JavaScript
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
- 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?
May be interested
- Object Number in JavaScriptthe number object represents the date in the form of a numeric value, or an integer or floating-point number. generally, you don't need to worry about number objects because the browser automatically converts number literals to illustrate the number classes.
- Top site with many good JavaScript exercises to practicemany people, after taking javascript courses and being equipped with some knowledge of the language they pursue, are eager to improve and cultivate these learned skills. so this article will give you a list of the top 3 websites to actually make javascript.
- What is JavaScript?javascript is a programming language of html and web. it is lightweight and most commonly used as part of web pages, but their implementation allows client-side scripts to interact with users and create dynamic websites. it is an interpreted programming language with object-oriented capabilities.
- ! = and! == What is the difference in JavaScript?javascript includes operators like in other languages. an operator performs some operations on one or more operands (data values) and produces a result. today's article will help readers learn about 2! = and! == operators in javascript.
- Learn about ES6 in Javascriptes6 refers to version 6 of the ecma script programming language. ecma script is the standard name for javascript and version 6 is the next version after version 5, released in 2011.
- Summary of JavaScript exercises with sample codein order to make your javascript learning easier, tipsmake.com has compiled a number of javascript exercises with sample solutions for you to practice.
- JavaScript location in HTML Filethere is flexibility in providing javascript code anywhere in an html document. however, the most preferred ways to include javascript in an html file.
- How to Turn on JavaScriptjavascript is a language used in many websites to provide additional functionality and access to the user. developers use javascript to deliver a large part of their site's functionality to you, the user. your browser must have javascript...
- What is the difference between Java and JavaScript?although the names of java and javascript seem to be related (javascript seems to be a script in java?), but that's the only similarity. these two languages are not technically related to each other.
- Void keywords in JavaScriptvoid is an important keyword in javascript that can be used as a unary operator before its single operand, which can be in any type. this operator defines an expression to be evaluated without returning a value.