JSFiddle - React, Tailwind, and code Playground

by Tushar Jadhav

JavaScript

function isBitSet(no, index) {
    var bin = no.toString(2); // Convert to Binary
    index = bin.length - index; // Reverse the index, start from right to left
    return bin[index] == 1;
}
console.log(isBitSet(44, 2));