That will get fairly hairy, given that JavaScript doesn't have integers. x should be expected to be a IEEE 754 double (can one discriminate between NaNs in JavaScript?), but might also be a string (does "@" have one bit set?, or might it be EBCDIC?), an array, an object, null or undefined (do those have a bit pattern?)
Re: Do you know your bitwise operators?
#31JavaScript supports various bit manipulation operators, which treat their operands as 32 bits (and return a numerical value).