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 trialAndy Saini
5,287 PointsAlthough a single quote wrapped string is faster, why does Jason use double quotes wrapped strings in all his videos?
Due to string extrapolation, a single quote wrapped string is supposed to be faster than the double quote wrapped counterpart. Why does Jason use the latter in all the videos?
2 Answers
rdaniels
27,258 PointsTrue, single quotes for names can suffice. Just as long as you're aware that the possible error might occur, and know how to fix it. : ) Happy coding!
rdaniels
27,258 PointsI always use double quotes. Using single quotes can sometimes return unwanted results, such as when your string has an apostrophe in it. Then you would need to add a back-slash before the apostrophe to tell the computer to ignore/accept the apostrophe. Using double quotes bypasses this problem and the computer interprets the string correctly. A lot of the teachers in these videos only use single quotes, but I see it as a bad practice. I always use double quotes for strings. Hope this helps!
Andy Saini
5,287 PointsOk for complex strings, but when using strings such as names, I think single quotes can suffice..