+ 1

What are the hiden cases ?even the solution is same as the anwser

Well, in the javascript course about the function goal steam.l don't know what is wrong even if the solution is the same as the answer and the output result shows there are hidden cases 3 and 4 that are wrong. And l have been detaining there very long so please help me to pass the difficulty. let me go to the next course

15th Mar 2023, 4:05 PM
W X
W X - avatar
19 Respuestas
+ 9
W X , > please link your code here, so that we can see what your issue is.
15th Mar 2023, 4:07 PM
Lothar
Lothar - avatar
+ 4
I don't give ready-made codes, I gave you a hint what to fix. I cannot see your new code, so I don't know what exactly you deleted. Also check the output string: they must be written exactly as in the task description.
16th Mar 2023, 8:30 AM
Lisa
Lisa - avatar
+ 2
The 3rd condition is not a comparison. Just delete it.
15th Mar 2023, 5:01 PM
Lisa
Lisa - avatar
+ 2
= is assignment, not comparison
16th Mar 2023, 7:07 AM
Lisa
Lisa - avatar
+ 2
According to the task description we need to output "Draw" when there is a draw.
16th Mar 2023, 11:45 AM
Lisa
Lisa - avatar
+ 2
Thank you all😀the problem solved
18th Mar 2023, 7:26 AM
W X
W X - avatar
+ 1
W X your condtionals are unnecessarily complicated. you only need three. Also it's "Draw" not "draw". if(goalsTeam1>goalsTeam2) console.log("Team 1 won") else if(goalsTeam2>goalsTeam2) console.log("Team 2 won") else console.log("Draw")
17th Mar 2023, 12:23 PM
Bob_Li
Bob_Li - avatar
0
How to make a link
15th Mar 2023, 4:27 PM
W X
W X - 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 if(goalsTeam1=goalsTeam2){ console.log("draw"); } else if(goalsTeam1==goalsTeam2){ console.log("draw"); } else if(goalsTeam1===goalsTeam2){ console.log("draw"); } //else if(goalsTeam1==goalsTeam2){ // console.log("draw"); //} //else if(goalsTeam1=goalsTeam2){ //console.log("draw"); //} };
15th Mar 2023, 4:28 PM
W X
W X - avatar
0
Well, not the reason, conditions 3 and 4 are the guesses l made to the hidden cases 3 and 4. in the math there are 3 conditions <, >, =.but there are 5 cases.
16th Mar 2023, 7:02 AM
W X
W X - avatar
0
😩
16th Mar 2023, 7:09 AM
W X
W X - avatar
0
l deleted it, seems not to work
16th Mar 2023, 7:10 AM
W X
W X - avatar
0
So, could you try it before telling me the right ways to solve the question 😀
16th Mar 2023, 7:11 AM
W X
W X - avatar
0
JavaScript 26.2
16th Mar 2023, 7:14 AM
W X
W X - avatar
0
But my solution is the same as the answer, which shows three conditions. but three hidden cases are locked, which are cases 3, 4, and 5. so except goalsTeam1 won, goalsTeam2 won or draw.what else situation could happen that have five test cases?
16th Mar 2023, 11:17 AM
W X
W X - avatar
0
😅
16th Mar 2023, 2:40 PM
W X
W X - avatar
0
So, l know. you know. But the results don't know
16th Mar 2023, 2:43 PM
W X
W X - avatar
0
Why not tell me the answer directly
16th Mar 2023, 2:48 PM
W X
W X - avatar