JavaScript Boole-verwysing
JavaScript Booleans
JavaScript booleans kan een van twee waardes hê: true
of
false
.
Die Boolean() funksie
Jy kan die Boolean()
funksie gebruik om uit te vind of 'n uitdrukking waar is:
Voorbeeld
Boolean(10 > 9)
Of selfs makliker:
Voorbeeld
(10 > 9)
10 > 9
Vir 'n tutoriaal oor booleans, lees ons JavaScript Boolean-tutoriaal .
JavaScript Boole-metodes
Method | Description |
---|---|
toString() | Converts a boolean value to a string, and returns the result |
valueOf() | Returns the primitive value of a boolean |
JavaScript Boole-eienskappe
Property | Description |
---|---|
constructor | Returns the function that created JavaScript's Boolean prototype |
prototype | Allows you to add properties and methods to the Boolean prototype |