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.
Need help understanding the usage of commas and quotation marks used here in the lesson
I understood you can interchange “ and ‘ (commas and quotation marks) as shown in the video lesson, right? Although to apply best practice you stay consistent, right? If so, I put quotation marks and it doesn’t run my code. What am I not getting about mixing commas and quotation marks used in the video versus me putting quotation marks at the end to be consistent?
Steven Parker216,865 Points
Commas ( , ) cannot be substituted for quotes ( " ), but apostrophes can ( ' also known as a "single quote").
And the code shown above is missing part of the last literal string. There should be something (perhaps just a period) and another apostrophe, and ideally a semicolon all before the "document.write" statement:
sentence += ' the ' + noun + ' // incomplete, unbalanced 's sentence += ' the ' + noun + '.'; // fixed