You have to return a list.
This comment is hidden because it contains spoiler information about the solution
Some of these tests are a little excessive. I am passing all the sample tests, but can't pass the final tests and can't compare because they're all too long to read and just say, "and x others"
thanks man,I finally managed to pull it off!!
search about "key sorting functions"
I'm new to this programming thing :D and , I'm stuck with 3 different arrays showing the 3 different sorting criteria.I know this is not stackoverflow but still..I need some help.How am I gonna be able to compare and rank the teams?
@ytorn I agree with you. From where I'm standing, there are only 3 few possible options:
I found an interesting thing - my sorting function is working perfectly in browser, but the result differs in codewars, that's why I can't solve the kata. And this this is not a first time when results differ. Would be very thankful for any advices or explanation.
@jsalinasf, I have faced exactly the same thing, and this is the main question - how to fixed something that is not visible. No errors, no timeout, nothing. Just half of tests is correct, another half is not and you can't discover what's wrong
Thank you all for taking the time to answer my question. @ytorn is correct, I can't use console.log() because of large size data. Just to clarify, I'm not receiving a timeout, the tests complete on time but the array Im returning is not equal to the expected one. I tried to login games, Rank, Team, For, etc but the only thing Im receiving is "expected [ Array(#) ] to deeply equal [ Array(#) ]". That's why I was wondering if maybe some good sould have a large dataset to test my code :)
Thanks for clarification!
Do you get a timeout? Then you may need to optimize your code. Otherwise I tried to debug my code by printing the table with Rank, Team, For, Against, GD, Points like in the description. Maybe this could be helpful.
Rank, Team, For, Against, GD, Points
The output should be an array of ranks for each team, not an array of teams for each rank. So the array [4, 4, 6, 3, 1, 2] means that the rank of Team 0 is 4, the rank of Team 1 is also 4, ..., the rank of Team 5 is 2.
A team, which has not played yet, got 0 points, 0 goals scored and 0 goals conceded. But with these stats the team can still be ranked.
[4, 4, 6, 3, 1, 2]
You cant debug with console.log() because of large size of data. I can't see neither input data (games), it looks like "... 422534 more items ]", nor output "expected [ Array(978) ] to deeply equal [ Array(978) ]". Any thoughts how to solve this if you even don't know where the problem is hidden? As it was said above, all smaller tests are passed successfully.
What the error message of the failed test? Btw, when 'big' tests are failing, I try to debug the code with console.log() for example. I hope this can help you to investigate the issue in your code.