Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Working With Numbers The Mad Libs Challenge Revisited

somethings wrong with my code

Not sure what's wrong with my code but none of it has worked in the browser yet. I have to assume I've made a syntax error but can't find it. Anyone care to take a look?


2 Answers

Joel Bardsley
Joel Bardsley
31,242 Points

Hi William, if you view the developer console in the web browser, you'll see get the Reference Error 'questions is not defined' on line 2. Here's the JS code that's contributing to this error:

var question = 3;
var questionsLeft = '[' + questions + ' questions left]';

You'll notice you've named your variable question but then have referenced questions throughout the rest of your code. Just make the necessary change to your variable name on line 1 and everything should work ok.

Thanks Joel