Build a Voting System - Build a Voting System

Tell us what’s happening:

Good day. i have been working on passing Step 17 and 18 for hours now and cant seem to get the solution it is asking. My return of displayResults() matches exactly what it tells me should be returned. is there something I’m not seeing? like and extra space or break? please help. thank you

Your code so far

const poll = new Map();

function addOption(option) {
  if (!option || option.trim() === "") {
    return "Option cannot be empty.";
  }

  if (poll.has(option)) {
    return `Option "${option}" already exists.`;
  }

  poll.set(option, new Set());
  return `Option "${option}" added to the poll.`;
}

function vote(option, voterId){
  if(!poll.has(option)){
    return `Option "${option}" does not exist.`;
  }
  const voters = poll.get(option);
  if(voters.has(voterId)){
    return `Voter ${voterId} has already voted for "${option}".`;
  }
  voters.add(voterId);
  return `Voter ${voterId} voted for "${option}".`;
}


function displayResults() {
  let output = 'Poll Results:';
  poll.forEach((voters, option) => {
    output += `\\n${option}: ${voters.size} votes`
});
  return output;
}

console.log(addOption("Turkey"));
console.log(addOption("Morocco"));
console.log(addOption("Spain"));

console.log(vote("Turkey", 2));
console.log(vote("Morocco", 1));
console.log(vote("Turkey", 3));

console.log(displayResults())









Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36

Challenge Information:

Build a Voting System - Build a Voting System

Sorry, literally just figured it out. this post can be closed. or deleted.

Thank you