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

Jonathan Pearson
PLUS
Jonathan Pearson
Courses Plus Student 6,704 Points

My code was working fine until I got to the ' [' + questions + ' questions left]' part.

I'm wondering if anyone could help me find out whats wrong with my code?

var questions = 3;
var questionsLeft = ' [' + questions + ' questions left]';
var adjective = prompt('Please type an adjective' = questionsLeft);
var verb = prompt('Please type a verb');
var noun = prompt('Please type a noun');
alert('All done. Ready for the message?');
var sentence = "<h2>There once was a " + adjective;
sentence += ' programmer who wanted to use JavaScript to ' + verb;
sentence += ' the ' + noun + '.</h2>';
document.write(sentence);

1 Answer

Hi Jonathan,

Not sure if this is the issue but one thing I've noticed is that this line has an = before questionsLeft instead of a +:

var adjective = prompt('Please type an adjective' = questionsLeft);

-Rich

Jonathan Pearson
Jonathan Pearson
Courses Plus Student 6,704 Points

That was it! Can't believe I missed it! Thank you very much!

No problem. I find that no matter how much I stare at code sometimes a fresh pair of eyes can spot the issue quicker :)