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 trial

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Paul Marshall
seal-mask
.a{fill-rule:evenodd;}techdegree
Paul Marshall
Full Stack JavaScript Techdegree Student 3,950 Points

even typing exaclty what the video types i still cant get the prompt to show

iono but im having great difficulty practicing

Adam Beer
Adam Beer
11,314 Points

Show your code.

Code

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

or

You can use the snapshot function in the workspace and provide the link to that.

Paul Marshall
seal-mask
.a{fill-rule:evenodd;}techdegree
Paul Marshall
Full Stack JavaScript Techdegree Student 3,950 Points

"<h2> This gave me lot of [adjective].It made me want to get my [noun].</h2>"

var adjective = prompt('Please type an adjective'); docmument.write(adjective);

The snapshot thng doesnt work

Adam Beer
Adam Beer
11,314 Points
"<h2> This gave me lot of [adjective].It made me want to get my [noun].</h2>"
var adjective = prompt('Please type an adjective'); 
docmument.write(adjective);
Paul Marshall
seal-mask
.a{fill-rule:evenodd;}techdegree
Paul Marshall
Full Stack JavaScript Techdegree Student 3,950 Points

//ultimate Quiz var correct = 0

//First Question var question1 = prompt('What is New Jersey State Capitol?');

if ( question1.toUpperCase === 'TRENT' ){ correct += 1; } else { document.write('wrong'); }

i figured out the last issue but now this one, i just don't understand regardless of what i type as an input "TRENT" or trent or even "nonsense", the output comes back as wrong (my else statement) please help!

4 Answers

Adam Beer
Adam Beer
11,314 Points

Your code is good. This is the good way. You misspelled the document.write(). Please fixed your document.write.

docmument.write(adjective);

change to

document.write(adjective);

Delete the + m.

Adam Beer
Adam Beer
11,314 Points

Of course! :) You can use the snapshot function in the workspace and provide the link to that.

Adam Beer
Adam Beer
11,314 Points

There were many minor mistakes in it. Now I've fixed it but please look over my solution. First, after toUpperCase() method I use (). Second, after the "if" statement I don't use semicolons. For example:

  if ( question2.toUpperCase === 'GSP');{
    correct += 1; 
  }

And I deleted it

  if ( question2.toUpperCase() === 'GSP'){
    correct += 1; 
  }

Third, I think the first alert is unnecessary, but if you want to use then use it. Fourth, inside the //output ranking I deleted the last else conditons. We don't use condition inside the last closing else. Finally, after the last two document.write you write <strong><p></strong></p> but the good way is the <p><strong></strong></p>.

//ultimate Quiz
var correct = 0

//First Question
var question1 = prompt('What is New Jersey State Capitol?');
  if ( question1.toUpperCase() === 'TRENT' ){
   correct += 1;

 }
 //second Quest.
var question2 = prompt('What highway is named after NewJerseys nickname?');
  if ( question2.toUpperCase() === 'GSP'){
    correct += 1; 
  }
//3rd Quest.
var question3 = prompt('What highway runs from North to South Jersey?');
  if ( question3.toUpperCase() === 'NJTP'){
    correct += 1;
  }
//output.
document.write('<p>your score is ' + correct + ' of 3</p>');


//output Ranking
if ( correct === 3 ){
    document.write("<p><strong>you earned a Gold Star</strong></p>");
} else if (correct === 2 ){
    document.write("<p><strong>silver star</strong></p>");
}else {
    document.write('<p><strong>MAN YOU NOT FROM NJ</strong></p>');
}

Please check if...else statement syntax, and how work toUpperCase() method. Hope this help.