I have also struggled with this problem, so have 2 suggestions for you
When trying to resolve a challenge in Playground, I replace the input with a pre-written example for the code to test
var example = readline() // replace
var example = "test this instead"
If you wish, you could also play with this snippet written by Vasiliy
Abhay Could you elaborate further regarding prompt() as it did not work for me when I tested.