Need an Assessment for Silly Story Generator

Have tried the hands-on . I have linked the source code below. Would love to hear the feedback .

Great work @korivikeerthi9799,

The code works and generates a new story every single time. I had had to do this whole exercise again to remember how to do it. I noticed the following

  1. You have put the randomValuefromArray into the result() function. I had a hell of a time trying to figure out how to generate a random array without doing what you did. Ideally what the result function should do is to call x, y and z Item and create a new random instance from the array each time. However if you you dont reset the x. y and z items they stay the same.
  2. You can use regular expressions to deal with the repetition of xItem. See the bit that says

There are three instances of strings that need to be replaced. You may repeat the replace() method multiple times, or you can use regular expressions. For instance, let text = 'I am the biggest lover, I love my love'; text.replace(/love/g,'like'); will replace all instances of ‘love’ to ‘like’. Remember, Strings are immutable!

This is a really tough challenge and its great that you have got it to work. Well done and keep learning. :sunglasses::muscle:t4:

I have saved my codepen if you want to look at what I mean.

Thanks @Ran for reviewing the code , and yea that regex I haven’t learnt to use it yet , Thanks for the suggest . will learn it !!!

1 Like