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 trialPaige Christensen
Data Analysis Techdegree Student 3,706 PointsI am having an issue with my prompt displaying.
Here is the code I copied along with the video, but when I previewed it, there is no prompt. I believe it's probably a syntax issue but I am having trouble finding it.
const questions [
['How many planets are in the Solar System?', '8'],
['How many continents are there?', '7'],
['How many legs does an insect have?', '6'],
['What year was JavaScript created?', '1995']
];
let correctAnswers = 0;
for ( let i = 0; i < questions.length; i++ ) { let question = questions[i][0]; let answer = questions[i][1]; let response = prompt(question);
if ( response === answer) { correctAnswers++; } }
1 Answer
jb30
44,807 PointsIn the line const questions [ ['How many planets are in the Solar System?', '8'], ['How many continents are there?', '7'], ['How many legs does an insect have?', '6'], ['What year was JavaScript created?', '1995']
];
you are missing an equal sign after questions
.
Paige Christensen
Data Analysis Techdegree Student 3,706 PointsPaige Christensen
Data Analysis Techdegree Student 3,706 PointsThanks jb30. I knew it was something simple, just needed some fresh eyes.