# Assesment wanted for Silly story generator

**URL:** <https://discourse.mozilla.org/t/assesment-wanted-for-silly-story-generator/79785>\
**Category:** Learn\
**Created:** [May 5, 2021, 5:10pm UTC](https://discourse.mozilla.org/t/assesment-wanted-for-silly-story-generator/79785 "2021-05-05T17:10:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mamenchuweb](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@mamenchuweb](https://discourse.mozilla.org/u/mamenchuweb)\
**Post date:** [May 5, 2021, 5:10pm UTC](https://discourse.mozilla.org/t/assesment-wanted-for-silly-story-generator/79785/1 "2021-05-05T17:10:08Z")

</div>

Hi. I think I’ve followed the instructions but It doesn’t work I don’t know way. Could anybody help me?. I have placed the code in CodePen. By the way, I’m new to CodePen as well so I don’t know how to provide you with the links and so on. But I will try. My user name is Amapola Negra. Thanks in advance.

Regards

---

<div class="post-metadata">

**Author:** ![justsomeone](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/justsomeone/32/67787_2.png) [@justsomeone](https://discourse.mozilla.org/u/justsomeone)\
**Post date:** [May 6, 2021, 9:04am UTC](https://discourse.mozilla.org/t/assesment-wanted-for-silly-story-generator/79785/2 "2021-05-06T09:04:04Z")

</div>

Hello @mamenchuweb

go to your codepen and and send us the link for the project it the same link you see in the address bar of your browser when you navigating to it

hope that help and have a nice day 🙂

---

<div class="post-metadata">

**Author:** ![mamenchuweb](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@mamenchuweb](https://discourse.mozilla.org/u/mamenchuweb)\
**Post date:** [May 10, 2021, 3:39pm UTC](https://discourse.mozilla.org/t/assesment-wanted-for-silly-story-generator/79785/3 "2021-05-10T15:39:08Z")

</div>

Hi. Thanks in advance. Here you have the link [https://codepen.io/amapola-negra/pen/abJbdEN](https://codepen.io/amapola-negra/pen/abJbdEN).

Regards 🙂

---

<div class="post-metadata">

**Author:** ![justsomeone](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/justsomeone/32/67787_2.png) [@justsomeone](https://discourse.mozilla.org/u/justsomeone)\
**Post date:** [May 10, 2021, 9:11pm UTC](https://discourse.mozilla.org/t/assesment-wanted-for-silly-story-generator/79785/4 "2021-05-10T21:11:59Z")

</div>

you very welcome

here are the issue

1. `if(customName.value !== '') what will happened if the user did not provide any data to the customName input ;)`

2. you defined ` let newStory= storyText;` inside the if statment block that mean it does not exist outside that block  
that why when you try to access it later it show it as undefined  
go to the developer tool in your browser and check the console tab and you will see that it report it not defined

3. `if(document.getElementById("uk").checked)` this will work in case if the user was in us then change it to uk but if the user decide later to change from the uk back to us it will still show the uk version

4. there 2 copy of “:insertx:” in the text so you need to replace both of them

you can use same replace(it replace the first occurrence only) method twice or check this one

> **[String.prototype.replaceAll() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll)**
>
> The replaceAll() method of String values returns a new string with all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. The...

try to fix those and if you find anything from the output that i missed try to fix it also

always check the console when use js code it help alot and you can use  
console.log( write any value or string or variable here) and it will print it to the console so you maybe use it to check if the if condition work or the value of certain variable calculated as it should be

hope that help and have a nice day 🙂
