Hi @krasnovdanial and welcome back to the community
Chris isn’t working for Mozilla anymore but we are a small group of volunteers who love to help others with assessments.
Congratulations! The code is correct and it works as intended.
Some advice to improve your code in general:
- Make sure you consistently indent your code makes it easier to read
- Use empty lines in larger functions to group similar things makes it also easier to read (example at the end)
- Use
const
by default and only use let
when the value of the variable will change. In your task the only variable that changes is newStory
. All other let
can be changed to const
helps to not make wrong assignments by accident (I see that in raw-text.txt
there are also some unnecessary let
. I will change that)
I hope that helps. Feel free to ask any questions or to come back with more tasks to be assessed
Have a nice day!
Michael
function result() {
let newStory = storyText;
const xItem = randomValueFromArray(insertX);
const yItem = randomValueFromArray(insertY);
const zItem = randomValueFromArray(insertZ);
newStory = newStory.replace(':insertx:',xItem);
newStory = newStory.replace(':insertx:',xItem);
newStory = newStory.replace(':inserty:',yItem);
newStory = newStory.replace(':insertz:',zItem);
...