This is what worked for me, although as far as I can tell it’s the exact same output.
The “Poll Results:” string needs to end with a newline \n.
The “votes” string needs to have a newline at the end.
you need to remove the last \n before returning the final string.
That does explain this error in the browser console:
TypeError: poll is undefined
It would be nice if this error showed in the FCC editor console, or if the test shared the result it’s receiving? Then we could see the test isn’t getting a result and investigate further based on that.
I just did it, and the test for the displayResults() output is very specific.
You can’t have any space or newline characters before “Poll Results:”, and you have to have newline characters in between each key-value pair output and the between the title and the first pair.
And it also expects no spaces/newlines after the last line.