0
You are given a program that takes Team 1 and Team 2 football teams goals as inputs accordingly. Complete the function to take
3 Respuestas
+ 1
You can't put a conditional statement in your else section. Either make it another "else if" or remove the part (goals1 === goals2)... also, are you sure you want === and not ==?
0
function main() {
var goalsTeam1 = parseInt(readLine(), 10);
var goalsTeam2 = parseInt(readLine(), 10);
// function call
finalResult(goalsTeam1, goalsTeam2)
}
//complete the function
function finalResult(goalsTeam1,goalsTeam2){
if(goalsTeam1>goalsTeam2){
console.log("Team 1 won");
}
else if(goalsTeam1 < goalsTeam2){
console.log("Team 2 won");
}
else(goalsTeam1 === goalsTeam2){
console.log("Draw");
}
}
Where is error in this code
I don't understood
Please help me
0
👍