Tham khảo Boolean JavaScript
Boolean JavaScript
Boolean JavaScript có thể có một trong hai giá trị: true
hoặc false
.
Hàm Boolean()
Bạn có thể sử dụng hàm Boolean()
để tìm hiểu xem một biểu thức có đúng hay không:
Hoặc thậm chí dễ dàng hơn:
(10 > 9)
Hãy tự mình thử »Xem thêm:
Các phương thức và thuộc tính Boolean của JavaScript
Name | Description |
---|---|
constructor | Returns the function that created JavaScript's Boolean prototype |
prototype | Allows you to add properties and methods to the Boolean prototype |
toString() | Converts a boolean value to a string, and returns the result |
valueOf() | Returns the primitive value of a boolean |