JS 26.2 Practice Multiple Parameters -- need help
Hey guys, I can't figure out what's wrong with this bit of code. I'm not sure if i'm even doing this right, because I didn't use parameters? Problem: You are given a program that takes Team 1 and Team 2 football teams goals as inputs accordingly. Complete the function to take Team 1 and Team 2 goals as arguments and output the final result of the match: - "Team 1 won", if Team 1's score is higher than Team 2's score - "Team 2 won", if Team 2's score is higher than Team 1's score - "Draw", if the scores are equal Sample Input 3 4 Sample Output Team 2 won Here's what I tried: function main() { var goalsTeam1 = parseInt(readLine(), 10); var goalsTeam2 = parseInt(readLine(), 10); // function call finalResult(goalsTeam1, goalsTeam2) } //complete the function function finalResult() { if(goalsTeam1>goalsTeam2){ document.write("Team 1 Won") } else if(goalsTeam2>goalsTeam1){ document.write("Team 2 Won") }else{ document.write("Draw") } };