Referencia booleana de JavaScript
Booleanos de JavaScript
Los valores booleanos de JavaScript pueden tener uno de dos valores: true
o
false
.
La función booleana()
Puede usar la Boolean()
función para averiguar si una expresión es verdadera:
Ejemplo
Boolean(10 > 9)
O aún más fácil:
Ejemplo
(10 > 9)
10 > 9
Para ver un tutorial sobre booleanos, lea nuestro Tutorial de booleanos de JavaScript .
Métodos booleanos de JavaScript
Method | Description |
---|---|
toString() | Converts a boolean value to a string, and returns the result |
valueOf() | Returns the primitive value of a boolean |
Propiedades booleanas de JavaScript
Property | Description |
---|---|
constructor | Returns the function that created JavaScript's Boolean prototype |
prototype | Allows you to add properties and methods to the Boolean prototype |