I am currently storing data inside an XML doc as binary, 20 digits long, each representing a boolean value.
Assuming you have no more than 32 bits, you can use JavaScript's built-in parseInt()
function to convert your string of 1s and 0s into an integer, and then test the flags using the &
(and) operator:
var flags = parseInt("10001010100011110000", 2); // base 2
if ( flags & 0x1 )
{
// do something
}
...
(question is on the use in C, but applies to the same operators in JS as well)