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 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?

https://w.trhou.se/jkaylx0ryq

2 Answers

Joel Bardsley
Joel Bardsley
31,248 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