title: Javascript checkbox if condition
body: <p>I wanted to trigger an if condition based on a checked or unchecked checkbox, by clicking a button.
  The code segments of interest are: </p>
  
  <pre><code> Out-Projekt: &lt;input type= "checkbox" id= "OUT"&gt; &lt;br&gt; &lt;br&gt;
   &lt;button  class = "buttonz" onclick = "berechnung()"&gt;Berechnen &lt;/button&gt;          
  
  &lt;script&gt;
   function berechnung() {
   var OUT = parseInt(document.getElementById("OUT").checked);
  
  if( checkbox.checked == true){ code}
   else { code }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>For some reason, it does not work. I read other topics regarding this but found nothing suitable. Hope someone can help</p>