Even though the following code is working properly, my boss mentioned that I should return a flag (variable) instead of returning true or false. I understand that part, but my question is how do I get the variable's value within my form. This is my form:

```
<form id="myForm" action="post.php" method="post" onsubmit="return validate();">

```

and this is my JavaScript code 

```
function validate(){

        if(document.getElementById('postTW').checked || document.getElementById('postFB').checked){

            var twFlag = false;
            var fbFlag = false;
            var form = document.getElementById("myForm");
            var twChecker = document.getElementsByName('twitter[]');
            var fbChecker = document.getElementsByName('fbPages[]');
            for (var i = 0; i < twChecker.length; i++) {
                if(twChecker[i].checked){
                    twFlag = true;
                }

        };
        for (var j = 0; j < fbChecker.length; j++) {
            if(fbChecker[j].checked){
                fbFlag = true;
            }
        };

        if(twFlag === false && fbFlag === false){
            alert("We can't proceed, not enough arguments");
            form.reset();
            return false;
        }
        if (fbFlag === twFlag){
            alert("tw and fb would be posted");
            return true;

        }
        else if (fbFlag === true && twFlag === false)
        {
            alert("only fb would be posted");
            return true;
        }
        else if (fbFlag === false && twFlag === true){
            alert("Only tw would be posted");
            return true;
        }

        else{
            alert("Not enough arguments ");
            form.reset();
            return false;
        }

    }

    else{
        alert("Not enough arguments to submit the form");

        return false;
    }

}

```

Thank you for any advice