Référence booléenne JavaScript
Booléens JavaScript
Les booléens JavaScript peuvent avoir l'une des deux valeurs suivantes : true
ou
false
.
La fonction booléenne()
Vous pouvez utiliser la Boolean()
fonction pour savoir si une expression est vraie :
Exemple
Boolean(10 > 9)
Ou encore plus simple :
Exemple
(10 > 9)
10 > 9
Pour un tutoriel sur les booléens, lisez notre JavaScript Boolean Tutorial .
Méthodes booléennes JavaScript
Method | Description |
---|---|
toString() | Converts a boolean value to a string, and returns the result |
valueOf() | Returns the primitive value of a boolean |
Propriétés booléennes 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 |