[Solved] Java Script Logical Operator In IF ELSEIF Statement [closed]


You can modify your script like this. Since you are checking the grade for greater than 80 in the else part, you need not to use && operator. Also your braces were missing.

<script>
    function myFunction() {
    var grade=document.getElementById("txtgrade");
        if (grade.value >= 90) {
            document.getElementById("demo").innerHTML = "Letter Grade is 'A'";
        } else if (grade.value >= 80) {
            document.getElementById("demo").innerHTML = "Letter Grade is 'B'";
        }
    }
</script>

solved Java Script Logical Operator In IF ELSEIF Statement [closed]