title: Setting specific bits in a number
body: <p>var d = 7;</p>
  
  <p>in binary: 7 = (111)</p>
  
  <p>What I want to do is to set second place from right to 1 or 0 at disposal,</p>
  
  <p>and return the decimal value.</p>
  
  <p>For example,if I want to make the second 1 to 0,then after process should return a 5,</p>
  
  <p>because 5=(101).</p>
  
  <p>How to implement this in javascript? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>the answer should be something like this:</p>
  
  <pre><code>function func(decimal,n_from_right,zero_or_one)
  {
  
  }
  </code></pre>
  
  <p>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.</p>