0

You are given a program that takes Team 1 and Team 2 football teams goals as inputs accordingly. Complete the function to take

8th Feb 2023, 12:57 AM
ANIL KUMAR VIHSWAKARMA
ANIL KUMAR VIHSWAKARMA - avatar
3 ответов
+ 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 ==?
8th Feb 2023, 1:57 AM
Ausgrindtube
Ausgrindtube - avatar
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
8th Feb 2023, 1:01 AM
ANIL KUMAR VIHSWAKARMA
ANIL KUMAR VIHSWAKARMA - avatar
0
👍
8th Feb 2023, 12:46 PM
ANIL KUMAR VIHSWAKARMA
ANIL KUMAR VIHSWAKARMA - avatar