Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Working With Numbers The Mad Libs Challenge Revisited

single quotes outside wrapping square brackets

I worked through this lesson and everything makes sense except the funky single quotes surrounding the opening square bracket and then again outside the closing bracket on the questionsLeft variable throughout the script. I don't understand what they're doing there? Check out lines 2, 5, and 8. Anyway if someone could help me understand what the purpose is that would be great! https://w.trhou.se/26gx4yla5o

1 Answer

The brackets aren't part of the code in this instance. They're a part of the string that will print something like this [3 questions left]

so the brackets are just there to help separate things visually?

Yes, it's to format the output a certain way for the user. This was the Teacher's personal preference but you can do something else if you want.