Javascript script help SyntaxError: missing; before statement

1

Good night, I'm having trouble making if / else if / else conditions in javascript, in the course of js codecademy works, but when I try to do some algorithms in the sublime using the conditional, it gives the error described in the title. p>

<script>
    var note1, note2, media;

        note1 = parseFloat(prompt("Informe a primeira nota"));
        note2 = parseFloat(prompt("Informe a segunda nota"));

        media = (note1 + note2) / 2;

        if (media >= 5.0) or (media <= 6.0){
            console.log("Você é um mau aluno");
        }
        else if (media >= 6.1) or (media <= 7.0) {
            console.log("Você é um aluno mediano");
        }
        else {
            console.log("Você é um excelente aluno");
        }
</script>
    
asked by anonymous 18.03.2016 / 05:16

1 answer

1

The entire condition in if must be within parentheses.

  • You can use multiple parentheses within if , provided you have one parenting all
  • Your comparisons are wrong, some languages accept or and and but in java script if you use && to and and || to or
  • if ((media >= 5.0) || (media <= 6.0)){
    //...
    else if ((media >= 6.1) || (media <= 7.0)){
    
        
    18.03.2016 / 05:33