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!
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
What is the purpose the brackets ?
This question was already asked, but my question is still not resolved. Why isn't:
var questionsLeft = questions + " left";
They don't serve any purpose beyond styling the output. They are in no way essential. If you prefer not to include them then that won't affect anything but how it looks when it is printed out.
Dave wanted the output to look like this:
[x questions left]
With your code it will look like this:
In both of these examples
x is a placeholder for the number of questions.
So to answer your question more directly, both would be equally acceptable. In programming there is rarely (almost never) only one acceptable way of doing something. And that is especially true when it comes to how you style output from your program, as styling is an inherently opinion driven thing.
Elkhan Khanmamedov1,780 Points
thanks, great explanation, now it's clear to me as well!!!