Retrieves the value of the bit at the specified position in a number.
1 if the bit at position k is set, otherwise 0.
1
k
0
getBit(0b1010, 1); // → 1 (bit 1 is set)getBit(0b1010, 0); // → 0 (bit 0 is clear)
The number from which to retrieve the bit.
Zero-based bit position to retrieve (0 = least-significant bit).
Generated using TypeDoc
Retrieves the value of the bit at the specified position in a number.
Returns
1if the bit at positionkis set, otherwise0.Example
Remarks