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

can't understand line 2

I don't understand the quotation marks and brackets

4 Answers

' [' is a string

  • questions + is a variable 'questions left]' is another string

it made sense when I looked at it next morning thank you for your help !

Dominique Mitchell
Dominique Mitchell
3,987 Points

Thank you for this explanation! I was stuck on that exact same thing.

Agnes Demes
Agnes Demes
6,613 Points

it might be clearer like this

// initital variable to hold questions declaired and intitialised to the value of 3
var questions =3;
/*new variable called questionsLeft declaired
this varriable will hold the string [ + the value of questions varriable + ] string so when it is printed it will display like this [ 2 questions left]
*/
var questionsLeft = '[ ' + questions + ' questions left ]';
// i
Agnes Demes
Agnes Demes
6,613 Points

yes thats it, well done! it sometimes good to take a break and look at it with fresh eyes.

Agnes Demes
Agnes Demes
6,613 Points

Hi, so at line 2 the teacher initially types a string format which he would like to apply late then he deletes line 2 at 1.02 as it was there just for reference. then the new line 2 is he declaires a new varriable called questionsLeft and makes it equal to , the questions varriable which is =3 at this point plus the to be printed string " questions left"

so when in use later in the program this code will display the current state of the questionsLeft varriable ( could be =1 or=2 or=3) and the string eg: 2 questions left hope this helps