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

YI JIANG
YI JIANG
3,424 Points

var questionsLeft = ' [' + questions + ' questions left]'; I don't get it why add [ ]

why add [ ],questionsLeft = ' [' + questions + ' questions left]';

Wow thanks for this question I was so confused with it as well

3 Answers

Hi Yi Jiang,

Try taking a look at the prompt at around 1:28 in the video.

You should see the prompt "Please type an adjective [3 questions left]"

The brackets are simply part of the prompt string. It was how Dave wanted the output to look but you can put whatever you want there.

Same here so it would not matter if I used () or [] in that string? Does that go for anytime we use () can we always substitute [] ?

Hi Mike,

If it's part of an output string then it wouldn't matter. It was only a personal preference on the part of the teacher to use the brackets.

Understood. Thank you for the reply.