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

Why did we need to create the string '[3 questions left]' in the first place?

This step is really confusing to me. We were told to place it, we weren't told why we needed to place it then we were told to remove it?

2 Answers

Ryan Ruscett
Ryan Ruscett
23,309 Points

Oh yeah I can see how that is confusing

He was making a reference to the type of string you were ultimately going to display.

This is an example of the string we want. that's all. '[3 questions left]'

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

Basically questionsLeft would print out to the screen as '[3 questions left]'

So once we finish creating questionsLeft variable. We can delete the example of how the variable will look.

A bit confusing but you are right. You don't need. He just put it there to help understand what the output of the string was going to look like.

Kinda like drawing a tattoo before getting it done. You use the drawing to help make the tattoo but once the tattoo is done you can toss the drawing.

Make sense?

+1 but in your line where you have code you are missing a ' beside the [ on the right side :P

Thanks for the explanation. I was really confused on this.

Ryan Ruscett
Ryan Ruscett
23,309 Points

Hey, points for catching that!!

Lolz! :D