# Need help with random quote machine project

**URL:** <https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [December 8, 2025, 9:43pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735 "2025-12-08T21:43:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 8, 2025, 9:43pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/1 "2025-12-08T21:43:37Z")

</div>

Greetings Distinguish Admin;

for the past week, I have been working on this project, precisely: “Random Quote Machine“. Appreciatively, this project has been one of the previous projects that has rolled me around to learn some other important aspects of Backend and Frontend Developer. In a concise phrase, the path has been a great one.

Furthermore, this project, that is the Random Quote Machine, has led me to spend a week on fetch(). Throughout the entire ended week, I was busy learning other application of fetch() and it was great.

Nonetheless, I came this week with the ideas I learned from fetch() exercises to apply some to the project on hand, but I have continued to have five more Tests failed. I have rearranged the same JavaScript code and checked for bug . I know I am missing something but I can’t figure it out at the moment. With that being said, can someone please take a look at my project and help me with some hints. Thanks in advance.

[https://codepen.io/hiekamara1/pen/YPqaBPo](https://codepen.io/hiekamara1/pen/YPqaBPo)

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [December 8, 2025, 10:10pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/2 "2025-12-08T22:10:49Z")

</div>

Don’t you also need to `await response1.json()`? And in `randomQuote()` you’re using a `data` variable that doesn’t appear to have been given a value.

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [December 8, 2025, 10:30pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/3 "2025-12-08T22:30:09Z")

</div>

> [@hiekamara1](#):
>
> continued to have five more Tests failed.

Maybe you’re in the middle of re-writing but the app should work before you run the tests.

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 8, 2025, 10:38pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/4 "2025-12-08T22:38:05Z")

</div>

The App is working. Some of the tests has ran. But the rest have not.

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 8, 2025, 10:46pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/5 "2025-12-08T22:46:36Z")

</div>

I did rewrite the HTML and and adjusted the CSS styles. Likewise the JavaScript too. I tried to used React, but I later decided to just continue with JavaScript

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 8, 2025, 10:53pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/6 "2025-12-08T22:53:50Z")

</div>

Thanks. I just updated those two lines of code blocks

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [December 8, 2025, 10:56pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/7 "2025-12-08T22:56:08Z")

</div>

There’s no quote. I click “New quote” and nothing happens. Shouldn’t a new quote appear in the box?

Can you confirm this api is working? `https://type.fit/api/quote`

Do you need a key?

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 9, 2025, 4:23pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/8 "2025-12-09T16:23:17Z")

</div>

Actually, it’s quite easy to map over the data fetched, but is it necessary in this project? I have updated the uniform resource locator (url) several times, but none of them retrieved the expected data anticipated. That is why I omitted the “s“ from the quote to try it again.

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 9, 2025, 4:27pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/9 "2025-12-09T16:27:36Z")

</div>

This url is working in search engine [https://type.fit/api/quotes](https://type.fit/api/quotes)

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [December 9, 2025, 4:43pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/10 "2025-12-09T16:43:26Z")

</div>

Do you get a quote showing up here?

 ![Screenshot 2025-12-09 114049](https://global.discourse-cdn.com/freecodecamp/original/4X/d/f/3/df356aab9a2180bac869fb1f4b9efcedcb439435.jpeg)

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [December 9, 2025, 5:39pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/11 "2025-12-09T17:39:18Z")

</div>

It looks like you are using the wrong variable name here

```auto
await fetch(url);

```

but once you get the correct name, you should open up the devtools to the network tab to see the error message when try to get a new quote.

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [December 9, 2025, 5:39pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/12 "2025-12-09T17:39:20Z")

</div>

After fixing a couple of things in your code, the console reported a cors issue: “Access to fetch at ‘[https://type.fit/api/quotes](https://type.fit/api/quotes)’ from origin ‘[https://cdpn.io](https://cdpn.io)’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

While it’s true you can access the data by directly clicking the link, you cannot access it via a `fetch(`). As I understand it, this can be fixed if using node; otherwise, it would need to be fixed on the server.

BTW, your latest code showed an error where the const `urL` was defined, but you used `url`. Also, `message` is part of the `error` object, not the other way around. And both of your external stylesheet links bombed on my end because the integrity could not be verified. When I removed the integrity and cross-origin attributes, the left quote displayed, but the twitter icon never did display.

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 9, 2025, 6:32pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/13 "2025-12-09T18:32:44Z")

</div>

Not at all. No quote has appeared on the interface. I wrote this same application in VS Code and result was the same. But I am still patiently applying other ideas .

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 9, 2025, 6:41pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/14 "2025-12-09T18:41:56Z")

</div>

Thanks once again for the update. I am certain that some of these errors occurred as a result of rearranging the code blocks. As for the twitter logo, that is another thing I have wrestled to have it display. I have changed the “hypertext reference‘ (href) of twitter, but the logo hasn’t still appeared.

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [December 9, 2025, 7:00pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/15 "2025-12-09T19:00:29Z")

</div>

Ok, thanks for confirming that. Everything should be working before you run the test suite.

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [December 9, 2025, 7:07pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/16 "2025-12-09T19:07:42Z")

</div>

You can find more information about the twitter logo here: [https://fontawesome.com/icons/twitter?f=brands&s=solid](https://fontawesome.com/icons/twitter?f=brands&s=solid)

---

<div class="post-metadata">

**Author:** ![dhess](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dhess/32/406235_2.png) [@dhess](https://forum.freecodecamp.org/u/dhess)\
**Post date:** [December 9, 2025, 8:22pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/17 "2025-12-09T20:22:19Z")

</div>

Try this for the Twitter issue:

> `<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />`

> `a { text-decoration: none; }`

> `<a class="fa fa-twitter sub-btn" id="tweet-quote" title="Tweet this quote!" href="https://x.com/intent/tweet" target="_blank"></a>`

😄

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 9, 2025, 9:34pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/18 "2025-12-09T21:34:11Z")

</div>

First and foremost, I would like to use this moment to say thank you. The generosity showed from everyone of you, has meant a lot and they have been humbly received. I am a student. I knew from the outset of this path, I would have encounter a lot of challenges. This notion was foresaw and it became one of the strenuous inspirations and/or motivations that led me alone this path of great engineers role models. Each challenge encountered sofar, has taught me something valuable and unforgettable. And these are just some of the positive effects that has been acquired. Thank you all.

Nonetheless, I will attach the twitter link and style the icon.

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 9, 2025, 9:46pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/19 "2025-12-09T21:46:34Z")

</div>

![twitter](https://global.discourse-cdn.com/freecodecamp/original/4X/8/d/8/8d84319a097c8f398bed4a8d3c3c960d2bc635b4.jpeg)

Thanks. Your generous help has helped this aspect to be resolved.

---

<div class="post-metadata">

**Author:** ![hiekamara1](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hiekamara1/32/349066_2.png) [@hiekamara1](https://forum.freecodecamp.org/u/hiekamara1)\
**Post date:** [December 12, 2025, 4:13pm UTC](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735/20 "2025-12-12T16:13:27Z")

</div>

I have done some adjustment to the project, but kept encountering “Uncaught TypeError“. Based on my finding and basic understanding of TypeError, it is a result of the action executed. But this result is contrary to the expectation. Can some take a quick look at the JavaScript in my project and point some diagnosis? Attached is copy of my screenshot. data.length is actually the total content assumed to be contain in the fetched data of the API.

 ![Uncaught TypeError](https://global.discourse-cdn.com/freecodecamp/original/4X/7/1/4/714e842ace488a541368e534398dd1445c6806d8.jpeg)

[Next page](https://forum.freecodecamp.org/t/need-help-with-random-quote-machine-project/769735.md?page=2)
