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


error : Cannot read property 'text' of undefined

https://w.trhou.se/b7xszd9w42 check out my code from challenge in prototype

1 Answer

18,814 Points

Welcome to Treehouse!

You don't seem to have a text property, which is why it is coming back as undefined. Perhaps you meant to get the quest property?

It also looks like when you're setting up your Quiz, you've left off an s from the passed argument name.

// quiz.js file
function Quiz(){
 this.questions = questions; // changed question to questions
 this.score = 0;
 this.currentIndex = 0;
// quiz_ui.js file
displayQues : function(){
  this.captureElement("question",quiz.getCurrentQues().quest); // changed text to quest

I think that should do it, but let me know if you still run into any issues. Happy coding! :)