Need some help with if else

Hei could someone help me with the code. I get error: Uncaught SyntaxError: Unexpected token ‘{’
I went trough the code a few times and i have no idea where is a mistake.

<html>
    <head>
        <title>My website</title>
    </head>
    <body>
        <script>
        var temp = prompt("what is your temp");

if (temp < 36.5){
    console.log("your temperature is below normal.");
}
else if ((36.5 < temp) && (temp < 37.5)){
    console.log("your temperature is normal.");
}
else (temp > 37.5){
    console.log("your temp is above normal");
}
        </script>
    </body>
</html>  
1 Like

Hey @zuzuluka, hope you are well.

Your last else have a condition, so it should be a else if.
The last else statement on any conditional if does not have a condition, it suppose to be “do this if all other conditional does not apply”.

Carlos Z.

3 Likes

owww yeah how did i miss that when i was looking on google.
It works now yeah thanks a lot.

Luka

1 Like