title: JavaScript - Using "checked/unchecked checkbox" as "IF ELSE condition statement"
body: <p>Now I want to use "check/unchecked checkbox" as "IF condition statement". </p>
  
  <p><strong>Example:</strong> I want to make a chord analyzer based on the note(s) you hit. When you check a note (or some notes) on checkbox, then press the button under those checkboxes, the paragraph element should tell you about what chord you hit. But there's error on my writing at <code>if ("error")</code> statement. How to fix it?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
     &lt;head&gt;
        &lt;script&gt;
         function fungsi() {
  
           var c = document.getElementById("C").checked;
           var e = document.getElementById("E").checked;
           var f = document.getElementById("F").checked;
           var g = document.getElementById("G").checked;
  
           if (c.checked = true &amp;&amp;
             e.checked = true &amp;&amp;
             g.checked = true &amp;&amp;
             f.checked = false) {
             document.getElementById("chord").innerHTML = "C Chord";
           } else if (c.checked = true &amp;&amp;
             f.checked = true &amp;&amp;
             g.checked = false &amp;&amp;
             e.checked = false) {
             document.getElementById("chord").innerHTML = "F Chord";
           } else {
             alert("Under Development!");
           }
         }
        &lt;/script&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;form&gt;
           Note(s) That You Hit:&lt;br&gt;
           &lt;input type=checkbox id="C"&gt;C&lt;br&gt;
           &lt;input type=checkbox id="E"&gt;E&lt;br&gt;
           &lt;input type=checkbox id="F"&gt;F&lt;br&gt;
           &lt;input type=checkbox id="G"&gt;G
        &lt;/form&gt;
        &lt;button type=button onclick="fungsi()"&gt;The Chord Is&lt;/button&gt;
        &lt;p id="chord"&gt;&lt;/p&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>