bitwise math question: how do you zero specific bits in a number without altering the rest of it?

i did some research and the solution i found for zeroing bits isn't working as anticipated in js.

the thing i am attempting is:
temp = ~mask (flips all bits)
output = temp & input

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!