Ad
  • Custom User Avatar

    You cannot delete a comment when a reply has been made to it.

    For your code, you misinterpret the expected result as the input. The input is given in the form of 2-dimensional array, each having a name and score respectively --> [[name1, score1], [name2, score2]...]. You have to define a list property that can retrieve a list in the form of [name1: score1, name2: score2, ...] sorted based on the given criteria.

  • Custom User Avatar
  • Custom User Avatar

    You did not consider the way back home in the price and you also calculate the price of a full tank when distance is 0. What if distance is 0 but there is still gas in the tank? ;-)

  • Default User Avatar

    If you want to console.log before an error occurs yoou should console.log. . . before this error may happen.
    I put a line in your code :

    for(var i in result)
    {
    console.log(`result: ${result}, result[i]: ${result[i]}, typeof result[i]:${typeof result[i]}`)  // <-- here is my line !
      result[i].reverse();
      result[i] = result[i].join(' ');
    }
    

    . . . and got this log :

     Add (chaining) 2 players
    Log
    result: Ada: 44,,,Bob,88,Clo,10, result[i]: Ada: 44, typeof result[i]: string
    
    

    When you try to use .reverse (an array method) on Ada: 44 (a string) an error happens !

    Don't give up poor po !

    ; ) )

    PS: nice new nick name !

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution