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 Loops, Arrays and Objects Tracking Data Using Objects The Student Record Search Challenge

liktid
liktid
6,387 Points

[SOLVED] Report doesnt show until quit or cancel - no safari

Hi there, i have the problem, that my code works fine as long as i type quit or cancel the search after i made an input. I couldnt find a mistake in my code, maybe someone has better eyes than me, I'm using Chrome btw.

Thank you

while (true) {
  var suchEingabe = prompt('Wie ist der Name?').toLowerCase();
  if (!suchEingabe || suchEingabe === 'quit') {
    break;
  }

    for (var i = 0; i < students.length; i++) {

      var html = '';
      var nameStudent = students[i].name;

      if (suchEingabe === nameStudent.toLowerCase()) {

        html += '<ul><li>' +
      'Name: ' + students[i].name + '</li><li>' +
      'Track: ' + students[i].track + '</li><li>' +
      'Badgets: ' + students[i].badgets + '</li><li>' +
      'Points: ' + students[i].points + '</li></ul>';
        writeThis(html);
      } 

    } 
}

Hi liktid, I've marked your question as [SOLVED]. Glad you figured it out.

1 Answer

liktid
liktid
6,387 Points

Is solved. My portable chrome was the source of the bug.