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 Foundations Strings Review of JavaScript Strings

Joseph Tingsanchali
Joseph Tingsanchali
5,262 Points

"Which of the following code snippet would store the string "This isn't my car!" into a variable?" answer is missing.

The answer choices are not correct. Two of them are the same and the correct answer is missing.

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Joseph;

After several times through that quiz I came across that question with the following answers available:

A var str = "This isn\'t my car!";

B var str = "This isn't my car!";

C var str = 'This isn\'t my car!';

D var str = 'This isn't my car!';

They are all different, there are either single or double quotes being used, along with the various escape sequences. Of those listed here, only B, the correct answer in my rendition of the quiz, works.

Joseph Tingsanchali
Joseph Tingsanchali
5,262 Points

Ken,

Ah, I think I didn't look at the answers well enough. In my version I saw two of these:

var str = "This isn\'t my car!";

I understand now. Thanks!