Treehouse: Grow your CSS skills. Land your dream job.

Help out a beginner?

  • # May 28, 2013 at 7:23 pm

    Hi. I’m very new to Javascript and I’ve been working on a Javascript quiz. I’m learning out of a book called [Javascript & jQuery: The Missing Manual]( “View this book on Amazon”) which is where I’m getting the code for the quiz. I’ve checked my code against the book’s code and everything seems to be the same, yet when I test it, my quiz bugs out and the book’s quiz works. Can someone please look at my javascript and find out what the problem is?

    Here’s the link to my quiz:

    Here’s the link to the book’s quiz:

    # May 28, 2013 at 7:32 pm

    Someone is missing a comma somewhere?!?!?!

    Maybe in an array?

    var questions = [

    # May 28, 2013 at 7:41 pm

    Also go to jsFiddle and enter your code in the javascript portion, then hit the button on top that says “JSHint”, it will reveal some mistakes :)

    # May 28, 2013 at 11:32 pm

    @JohnMotylJr : What a relief! Thank you so much for finding that error and for the jsFiddle tip!

    # May 29, 2013 at 12:26 am

    a suggestion:

    var questions = [


    putting the comma *before* the item makes it easier to troubleshoot: they’re all in the same column (whereas they might be in different columns at the end, because each array item has a different length). It’s always helpful to write your code in a way that makes mistakes more obvious.

    # May 29, 2013 at 2:21 pm

    @traq : Thanks for the advice! I’ll try that.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.