// A kind of cheeky solution that uses parseInt and toString with
// a binary radix specified.
functionreverseBits(n){
constBIT_SIZE=32;
lets=n.toString(2);
for(leti=BIT_SIZE-s.length;i>0;i--){
s="0"+s;// left pad zeros;
}
returnparseInt(s.split('').reverse().join(''),2);
}
highestOrderBit(43261596)// 00000010100101000001111010011100 in binary, 32 bits in total
reverseBits(43261596)
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.