JavaScript / High Score Board (task 4 - support)

Hi everyone.

I have found a possible bug in test script, but I am not sure. Is it maybe my code?

In task 4, the test take updateScore and run the next code:

updateScore(scoreBoard, 'Min-seo Shin', 1999);
const actual = updateScore(scoreBoard, 'Jesse Johnson', 1337);

However, the expected result is not consistent, because the input to “Jesse Johnson” player was “1337” and not “2674”:

const scoreBoard = {
      'Amil Pastorius': 99373,
      'Min-seo Shin': 0,
      'Jesse Johnson': 1337,
    };
const expected = {
      'Amil Pastorius': 99373,
      'Min-seo Shin': 1999,
      'Jesse Johnson': 2674,
    };

My code:

export function updateScore(scoreBoard, player, points) {
  scoreBoard[player] = points;
  return scoreBoard;
}

This bug keeping me stuck. I can’t pass the exercise.

Note the comment in the code:

/**
 * Increases a player's score by the given amount.
  1. Initially, Min-seo Shin has zero points, and Jesse Johnson has 1337 points.
  2. Then updateScore increases Min-seo’s score by 1999 points.
  3. Then updateScore increases Jesse’s by 1337 points.

The instructions are pretty explicit about it.

1 Like

:sweat_smile: true… sorry.