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 trialian truong
4,685 Pointsprompt(question)
for ( var i = 0; i < questionAnswer.length; i++){ question = questionAnswer[i][0]; answer = questionAnswer[i][1]; respond = parseInt(prompt(question)); }
i know that in a loop if u use i++, it adds one to the loop, but prompt(question) = [i][0]. doesn't "prompt(question)" just ask [i][0] again?
1 Answer
Mckenzie Hessel
Full Stack JavaScript Techdegree Graduate 20,437 PointsSince the value of i increases with each pass through the loop, the question at [i][0] will be different each time (it will go from [1][0] to [2][0] to [3][0] to [4][0] to [5][0]).