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 trialClinton Tessin
10,084 PointsMy alerts are not coming up.
Here is my code
var colorquestion = prompt("What is your favorite color?"); var streetquestion = prompt("What street did you grow up on?"); var questions = colorquestion.toUpperCase() + ' ' + streetquestion.toUpperCase(); var characterCount = questions.length; alert("The string \"" + questions + " " is " + characterCount + " characters long.");
I'm having a hard time understanding the quotes with . When I preview the code, nothing comes up. It's just a blank white page.
1 Answer
Emmanuel C
10,636 PointsHey, If you want to use double quotes inside a string you can wrap the whole string inside single quote. The same works vice versa.
alert('The string "' + questions + '" is "' + characterCount + '" characters long.');
to escape characters in JS you can use backslash \ before the character you want to escape, but youll have to do it before each character, which is not convenient for this situation
'John Doe\'s example '