Assessment Wanted for Silly Story Generator

I would really appreciate an assessment on the “Silly Story Generator” assignment. I placed my Javascript code (and the associated HTML/CSS) in this Code Pen page.

The page works and I believe my Javascript is correct, but I am a little shaky on Javascript in general, despite going over the lessons, so I’m not entirely sure if I made any mistakes.

Hi @dylan.gonzalez!

This is really good! It works fine, except for one small typo on the “fahrenheit” line, which means that the temprature substitutions isn’t made. The correct line is as follows:

newStory = newStory.replace('94 fahrenheit', temperature);

Well done on some great work!

1 Like

Thank you, @chrisdavidmills! Really appreciate the feedback!

Hi @chrisdavidmills, I would like appreciate an assessment on the “Silly Story Generator”. Everything is work but I feel something I can made it better. Please, advice to me what’s exactly. Here is my project https://glitch.com/edit/#!/silken-fork-brachiosaurus.

Hi @krasnovdanial and welcome back to the community :wave:

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. :medal_sports:

Some advice to improve your code in general:

  • Make sure you consistently indent your code :arrow_right: makes it easier to read
  • Use empty lines in larger functions to group similar things :arrow_right: 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 :arrow_right: 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 :slightly_smiling_face:

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);
  ...

baby-cry
:cry: :sob: :cry:

Thank you very much for all :slight_smile:

1 Like