Random Quote Machine - Is this enough?

Tell us what’s happening:

I have a functioning product, it passes all the tests and I’m planning to just pretty it up soon and then add it to the portfolio.

I’m curious if I was expected to use more than just jQuery from the front end libraries though.

I’ve just been struggling quite a bit with the React / Redux stuff and after looking at the 5 projects from this section, I can only see the one project where I would use React / Redux.

I know I shouldn’t overcomplicate things but, am I missing out from not using these technologies in these projects?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Build a Random Quote Machine

Link to the challenge:

If you are going to use jQuery, then don’t use the following:

<body onload="newQ();">

Instead, research using the ready method.

Also, your script element should typically be placed right before the closing body tag and not in the head element.

On a side note, since your quote machine only has about 5 quotes, I recommend implementing some logic to prevent the same quote from showing twice in row.

Thanks for the reply!

I’ve looked into the ready method and updated accordingly, I’ve also added 5 more quotes and fixed it so that it doesn’t show any quote twice in a row.

I always thought scripts for loading in jQuery and whatnot should go in the head? Are you referring to just the FreeCodeCamp tester element or all javascript elements?

The idea is to put any render/parser blocking resources late in the document load. You can also look into using async and defer (when applicable).

Critical Rendering Path and here is a stackoverflow thread.

I see!

So I at least want the basics of the site loaded before the JS starts getting loaded in otherwise the user is left waiting.

I guess not a problem here but a good habit to get into for bigger sites right?

Most scripts should not be loaded in the head unless you can defer. But there’s stuff like analytics that needs to run early in the page load.

I’d just get in the habit of doing the loading at the bottom or using defer/async. And as said, make sure not to do any manipulation of the DOM or CSSOM before they are ready.