Random Quote machine Structural issue

I think the tester for this project is broken. I havn’t included the functionality of the button to coincide with the challenge yet it tells me I have completed some tests.

Also I’m slightly confused with the structure as it is flagging up wrong but seems to flow correctly.

Any help with this would be appreciated so I can crack on

Your id attribute is not correct it should be #new-quote

And while fixing that would make you pass all but the layout test the app doesn’t really do what is asked for.

You are supposed to get a new quote when clicking the button and the text and author should be updated with the new quote. Also, the tweet button is supposed to have the quote in the href value so it can be posted to twitter.

As an aside, you need to fix the link to font awesome. And for later versions, the classes for the icon have changed.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<i class="fa-brands fa-twitter"></i>

//thank you the tweet update was useful. I’ve been working on this a bit more and figured out some better code although it still doesn’t work. Could you give me some advice on this javascript functionality please//

Random Quote machine (codepen.io)

Hi Randall

I’ve now changed the function code to a simpler method where I have first retrieved a random number. I’m now struggling to apply this number to match the quote within the array at the index given from the random number obtained. Do you have any tips?

Random Quote machine (codepen.io)

Thank you
I’m drawn towards using .map()
Should quotes.map(indexRandom) return a string or is there more to this? It doesn’t mutate the string which is great but the index value is still an issue

Thank you I’ve found a solution. Now just to tidy up the div to stop the layout moving when the text changes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.