Github Source Files:https://github.com/JS-Beginners/random-quotes-project This Random Quotes project is fairly simple. It calls for you to access the properties on an object that's embedded inside of an Array. When the “Generate Quote” button is pressed, it triggers a change in quote and the author who said it.
New things learned or refreshed:This project was fairly simple. However, John wrote out his solution using an immediately invoked function expression (IIFE). So, I changed my solution to do the same. It feels good learning how and why IIFEs can be useful. He makes sure to continually explain their purpose, which is to wrap our functions in IIFEs so we won't contaminate the global variable space.
Time to code:This took about 5 minutes to code.
Biggest take away:None really. It's good to see IIFEs being used on small problems so when I see them on larger problems, or in libraries like jQuery, I have a good guess as to why they exist.
Your Turn!What to accomplish:
- Download the source code from the github repository above.
- Delete the contents of the
app.jsfile (except for the quotes and author content of the array).
- Add a link to your finished project below!
- When you click on the “Generate” button, you should see a new random quote and the corresponding author.