Help, Silly story generator ignores new inputs until the page's refreshed(

Hi! Could you give me an assessment and help with an issue? The game creates new stories with the previous custom name and ignores new inputs until the page’s refreshed(

my code

the task

Hello @DiYuriivna

You’re replacing the name in the original storyText. You should initialize newStory with storyText at the start of result() and then only replace texts in newStory. This way every time we press the button a genuine newStory gets created and the original storyText is left as is.

Do you know what I mean?

By the way, you used a few vars in your code. These should be replaced with let/const.

Have a nice day,
Michael

Thanks a lot!
I fixed the code, now it works correctly.
And thanks for the advice about vars :slightly_smiling_face:

1 Like

Great improvements! Now everything is fine.

1 Like