title: how can i take the value outside of constant declared inside block
body: <p>in the below code ...i need to take the value of ...rate.. outside and have to do further calculation with some other output coming from other code blocks</p>
  <pre><code>let price=document.querySelectorAll('input[type=&quot;radio&quot;]');
  price.forEach(radio =&gt; {
       radio.addEventListener('click',()=&gt; {
        if(radio.checked){
           const rate= radio.value;
          console.log(rate);
          
        }
       }) 
  });
  
  const test=rate+4;
  console.log(test);
  </code></pre>
  <p>am getting an error....test is not defines...so what i have to do.....am very new to javascripr</p>