+ 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
18 ответов
+ 9
W X ,
> please link your code here, so that we can see what your issue is.
+ 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.
+ 2
The 3rd condition is not a comparison. Just delete it.
+ 2
= is assignment, not comparison
+ 2
According to the task description we need to output "Draw" when there is a draw.
+ 2
Thank you all😀the problem solved
+ 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")
0
How to make a link
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");
//}
};
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.
0
😩
0
l deleted it, seems not to work
0
So, could you try it before telling me the right ways to solve the question 😀
0
JavaScript 26.2
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?
0
😅
0
So, l know. you know. But the results don't know
0
Why not tell me the answer directly