[英]Is there such a thing as a proper `bit` in JavaScript?
I know that there is a Boolean object in JavaScript, but I'm wondering if there is a way to access the metal, the raw single bit
that lives at the heart of this Boolean object. I know that there is a Boolean object in JavaScript, but I'm wondering if there is a way to access the metal, the raw single bit
that lives at the heart of this Boolean object.
You can't access it, but you can assume true
is 1
and false
is 0
.您无法访问它,但您可以假设true
为1
并且false
为0
。
I don't know of any bit
type in javascript.我不知道 javascript 中的任何bit
类型。 If you're worried about conserving space and need to store a lot of bits, you could probably use int
s and Bitwise Operators in conjunction.如果您担心节省空间并需要存储大量位,则可以结合使用int
和位运算符。 You'd be manipulating the individual bits within each int (so 32 on most systems)您将操纵每个 int 中的各个位(在大多数系统上为 32)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.