Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Stuck on printQuote function...

I'm stuck on the the step- printQuote constructs a string containing the different properties of the quote object using the following HTML template.

Here's what I got thus far, but when I push the "show another quote" button, it doesn't do anything. Any thoughts??

https://w.trhou.se/5msvrdfnrt

1 Answer

Do the following changes in the 'script.js' file :

  1. Line 6 : replace .
    function getRandomQuote (0, 6) {
    with
    function getRandomQuote (lower, upper) {

  2. Line 13 : replace
    var nextQuote= getRandomQuote (quotes);
    with var nextQuote= getRandomQuote (0, 6);

  3. Line 16: Add + before the </p> as shown below

    '<p class="quote">' + nextQuote.quote + '</p>';

  4. With some more work you can append the source, citation, date and tags.