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 trialTamella Hajiyeva
Full Stack JavaScript Techdegree Student 6,678 PointsUncaught TypeError
Hi,
I am trying to run the code and after the first questions pops I get an Uncaught TypeError: Cannot read property '0' of undefined.
Error is referring to the question [i][0] and I am not sure what is going on.
for( let i = 0; i < arr.length; i++){ let question = arr[i][0]; let answer = arr[i][1]; let response = prompt(question);
if(answer === response){ correctAnswers++; } }
1 Answer
Tamella Hajiyeva
Full Stack JavaScript Techdegree Student 6,678 Pointsfound a cause of the problem. I forgot a comma between arrays of array