Referência booleana JavaScript
Booleanos JavaScript
Booleanos JavaScript podem ter um dos dois valores: true
ou
false
.
A função booleana()
Você pode usar a Boolean()
função para descobrir se uma expressão é verdadeira:
Exemplo
Boolean(10 > 9)
Ou ainda mais fácil:
Exemplo
(10 > 9)
10 > 9
Para um tutorial sobre booleanos, leia nosso JavaScript Boolean Tutorial .
Métodos booleanos JavaScript
Method | Description |
---|---|
toString() | Converts a boolean value to a string, and returns the result |
valueOf() | Returns the primitive value of a boolean |
Propriedades booleanas do 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 |