Check-Box is not checked through JavaScript

I was working on a project in that some situation comes out that:

  • optionC is by default checked When someone checked optionA and
    optionB then optionC should unchecked When someone checked optionC
    after it unchecked then optionB should unchecked When someone check

ed optionB after it unchecked then optionA should unchecked— Thats All!
Here is my Code:

var optionA = document.getElementById("optionA");
var optionB = document.getElementById("optionB");
var optionC = document.getElementById("optionC");
optionC.checked = true;
[ optionA, optionB, optionC ].forEach(function(option) {
   option.addEventListener("click", function() {
      if(optionA.checked && optionB.checked){
        optionC.checked = false;
      }
     else if(optionA.checked && optionB.checked && optionC.checked){
       optionB.checked = false;
     }
       //Here also Code is missing
     else{
  optionC.checked = true;
     }
   });
});

But I am facing an Error That after optionC is unchecked user is not able to check it again