var d = 7;
in binary: 7 = (111)
What I want to do is to set second place from right to 1 or 0 at disposal,
and return the decimal value.
For example,if I want to make the second 1 to 0,then after process should return a 5,
because 5=(101).
How to implement this in javascript?
EDIT
the answer should be something like this:
function func(decimal,n_from_right,zero_or_one)
{
}
Where decimal is the number to be processed, n_from_right is how many bits from right,in my example above it's 2. zero_or_one means to set that specific bit to 0 or 1 at disposal.