#JavaScript is a weird language; it has hashtag#bigint, but it doesn't have a function that returns a number of bits in the bigint. Neither it has hashtag#log2 function for the bigints. If you need a workaround for the problem https://medium.com/@sergeyshandar/improving-the-log2-algorithm-for-bigint-in-javascript-7e5692e7bf0b?sk=9ac18367f61b524704cc8d82707aed3d